Skip to content

Latest commit

 

History

History
62 lines (58 loc) · 5.21 KB

notes.md

File metadata and controls

62 lines (58 loc) · 5.21 KB

Scenarios to support

  • No Hosts file created Call Invoke-BundleCommand -Name beaker -... <list of beaker vars to override> The following should happen.
    • If no hypervisor and string are specified then the default hypervisor and string are chosen to generate an ephemeral hosts file at the location specified in the BEAKER_setfile location.
    • Env vars are set for the run.
      • A quick parse of the hosts file should be done to determine if this is a master/agent run or agent only and set env vars to match.
    • Ensure we are at the top level of the git repo
    • bundle install with defaults for --path and allow passing values to --without if these tasks have not already been accomplished. An override may exist to wipe and re-install on any given run.
    • bundle exec rake spec_prep if this has not already been done.
    • Bundle command is invoked. The string passed to Command is appended to bundle exec and run.
    • When tasks are complete
      • Remove all env vars that were set
      • If an autogenerated hosts file was used, delete it.
        • A hosts file should only have been generated if a hosts file did not already exists at the BEAKER_setfile location. An option should exist to auto generate the hosts file but not delete it.

Pitfalls and edge cases

  • Setting BEAKER_PUPPET_AGENT_VERSION to anything at all can cause some tests to fail. The usual setting of something in the 5 series causes an invalid url for older helpers. Simply omitting the var causes it to default to latest for the older series. Need to look at implementing a method to remove variables from the array of vars to set, both on the cmdline and by default in the conf file.

Public Cmdlets to create

  • Invoke-BundleCommand
    • Parameters
      • All defined named testing parameters
      • UserDefined Takes a hash table of custom parameters to set and then remove.
      • Hypervisor Helps to find the correct hosts string from the config.json file. Used in conjunction with the next parameter.
      • HostsString Take the name of defined hosts string in the json config file, or a raw host string to pass to beaker-hostgenerator
      • OverrideSet Take the name of an override set. These are named sets of individual variables that can override the default global values. These can be used to create named sets of parameters named after a module for instance, that can override single sets of values.
      • Command This is the command to put after bundle exec and invoke on the command line. For example Invoke-BundleCommand -Command 'rake beaker' will result in Invoke-Expression -Command 'bundle exec rake beaker'.
      • OverwriteHosts A switch parameter that will tell the cmdlet whether to overwrite a hosts file if it finds one already in place at the BEAKER_setfile location. If this parameter is ommitted then the hosts file it finds is used. This allows the user to manually tweak a hosts file and move those settings into the defined strings in the config file if needed, without the module constantly overwriting it.
      • BundlePath Override the default bundle path of .\bundle\gems
      • Verbose
    • Notes
      • Either or both of the Hypervisor and HostsString parameters can be omitted, and the default set in the config file will be used.
      • A user can pass a raw beaker-hostgenerator hosts string to HostsString and use that instead. If the value passed to HostsString does not match the name of a defined string from the config file, it is passed verbatim to beaker-hostgenerator.
  • Set-BeakerEnvVar
    • Parameters
      • ALl Defined named testing parameters
      • UserDefined Takes a hash table of custom parameters to set.
      • Verbose
    • Notes
      • This cmdlet will call the host generator after the env vars are set, because those vars often affect the output of the host generator.
      • Will call another cmdlet after the set file is generated to decide if any of the vars need to change based on whether the set file has a master defined or not.
      • The name of the cmdlet is singular to comply with the powershell naming convention, but the default behaviour sets many variables. I'm not sure how to reconsile the name and the behavior.
  • Remove-BeakerEnvVar
    • Parameters
      • UserDefined Takes a hash table of custom parameters to remove. Most of the time you should simply assign this as a hash variable and then pass the same variable to both the set and remove cmdlets to ensure they are all removed. If this parameter is passed into Invoke-BundleCommand then that is exactly what will happen in the begin{} and end{} blocks.
      • Verbose
  • New-Setfile
    • Parameters
      • OutPath Output file path for the generated file. Defaults to the BEAKER_setfile location.
      • String A raw string to pass to beaker-hostgenerator.
      • Hypervisor The hypervisor to select from the config file.
      • HostsString The name of the string from the specified hypervisor set.
      • Force Instructs the cmdlet to overwrite
      • Verbose
    • Notes
      • If no parameters are defined.
        • The default string will be used as defined in the config file.
        • Either or both of Hypervisor or HostsString can be used or omitted. Whichever value the cmdlet does not receive will be substituted for the defined default.