beaker 3.35.0 → 3.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +32 -9
  3. data/CHANGELOG.md +15 -1
  4. data/CONTRIBUTING.md +37 -31
  5. data/DOCUMENTING.md +68 -44
  6. data/README.md +14 -31
  7. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +3 -3
  8. data/beaker.gemspec +1 -1
  9. data/docs/README.md +5 -12
  10. data/docs/concepts/beaker_libraries.md +2 -2
  11. data/docs/concepts/glossary.md +11 -0
  12. data/docs/concepts/style_guide.md +24 -91
  13. data/docs/concepts/test_tagging.md +3 -10
  14. data/docs/concepts/testing_beaker_itself.md +3 -2
  15. data/docs/concepts/ticket_process.md +17 -45
  16. data/docs/how_to/archive_sut_files.md +7 -33
  17. data/docs/how_to/change_terminal_output_coloring.md +7 -4
  18. data/docs/how_to/confine.md +5 -16
  19. data/docs/how_to/debug_beaker_tests.md +14 -6
  20. data/docs/how_to/hosts/README.md +2 -5
  21. data/docs/how_to/hosts/archlinux.md +4 -2
  22. data/docs/how_to/hosts/cisco.md +9 -30
  23. data/docs/how_to/hosts/eos.md +5 -14
  24. data/docs/how_to/hypervisors/README.md +9 -31
  25. data/docs/how_to/install_puppet.md +16 -51
  26. data/docs/how_to/platform_specific_tag_confines.md +11 -31
  27. data/docs/how_to/preserve_hosts.md +13 -54
  28. data/docs/how_to/rake_tasks.md +1 -4
  29. data/docs/how_to/recipes.md +9 -2
  30. data/docs/how_to/run_in_parallel.md +10 -10
  31. data/docs/how_to/ssh_agent_forwarding.md +8 -13
  32. data/docs/how_to/ssh_connection_preference.md +10 -10
  33. data/docs/how_to/test_arbitrary_beaker_versions.md +5 -12
  34. data/docs/how_to/the_beaker_dsl.md +44 -21
  35. data/docs/how_to/upgrade_from_2_to_3.md +13 -53
  36. data/docs/how_to/use_hocon_helpers.md +10 -28
  37. data/docs/how_to/use_user_password_authentication.md +13 -10
  38. data/docs/how_to/write_a_beaker_test_for_a_module.md +6 -2
  39. data/docs/tutorials/README.md +14 -55
  40. data/docs/tutorials/creating_a_test_environment.md +47 -52
  41. data/docs/tutorials/installation.md +57 -21
  42. data/docs/tutorials/lets_write_a_test.md +8 -1
  43. data/docs/tutorials/quick_start_rake_tasks.md +63 -62
  44. data/docs/tutorials/subcommands.md +19 -32
  45. data/docs/tutorials/test_run.md +14 -16
  46. data/docs/tutorials/test_suites.md +14 -43
  47. data/docs/tutorials/the_command_line.md +14 -2
  48. data/lib/beaker/host/unix/pkg.rb +9 -2
  49. data/lib/beaker/host_prebuilt_steps.rb +1 -1
  50. data/lib/beaker/shared/host_manager.rb +6 -3
  51. data/lib/beaker/version.rb +1 -1
  52. data/spec/beaker/host/unix/pkg_spec.rb +66 -17
  53. data/spec/beaker/host/unix_spec.rb +4 -4
  54. data/spec/beaker/host_prebuilt_steps_spec.rb +10 -6
  55. data/spec/beaker/hypervisor/hypervisor_spec.rb +2 -2
  56. data/spec/beaker/shared/host_manager_spec.rb +8 -0
  57. metadata +9 -2
@@ -2,25 +2,15 @@
2
2
 
3
3
  ## What Are These?
4
4
 
5
- Typically when adding support for new platforms, a number of tests have to
6
- be confined away from executing on that new platform. This can be for a
7
- number of reasons, from partial implementation/support to tests having
8
- incorrect assumptions that don't work on the new platform.
5
+ Typically when adding support for new platforms, a number of tests have to be confined away from executing on that new platform. This can be for a number of reasons, from partial implementation/support to tests having incorrect assumptions that don't work on the new platform.
9
6
 
10
- Platform-specific tag confines are structures created to make this workflow
11
- easier, & achievable in a much more low-impact and adaptable way.
7
+ Platform-specific tag confines are structures created to make this workflow easier, & achievable in a much more low-impact and adaptable way.
12
8
 
13
9
  ## Ok, So How Do We Use Them?
14
10
 
15
- In the local options file (provided to the command line interface (CLI)
16
- using the `--options-file` parameter), you can now provide an array of
17
- hashes, where each hash specifies a platform to confine, based on the
18
- tags included in the test. The local options file key is
19
- `:platform_tag_confines`.
11
+ In the local options file (provided to the command line interface (CLI) using the `--options-file` parameter), you can now provide an array of hashes, where each hash specifies a platform to confine, based on the tags included in the test. The local options file key is `:platform_tag_confines`.
20
12
 
21
- An example local options file is included
22
- below (remember that local options files have to be readable into
23
- beaker as a ruby hash):
13
+ An example local options file is included below (remember that local options files have to be readable into beaker as a ruby hash):
24
14
 
25
15
  ```ruby
26
16
  {
@@ -43,18 +33,13 @@ beaker as a ruby hash):
43
33
  }
44
34
  ```
45
35
 
46
- In this case, there are two platform confines objects specified, one for
47
- Ubuntu 14.04, and the other for CentOS 7. These objects consist of a hash,
48
- filled with two entries: the `:platform` regex, and the `:tag_reason_hash`.
36
+ In this case, there are two platform confines objects specified, one for Ubuntu 14.04, and the other for CentOS 7. These objects consist of a hash, filled with two entries: the `:platform` regex, and the `:tag_reason_hash`.
49
37
 
50
- The `:platform` regex is just that, a Ruby regex matching the host's
51
- platform string.
38
+ The `:platform` regex is just that, a Ruby regex matching the host's platform string.
52
39
 
53
- The `:tag_reason_hash` is another hash that maps tags to the reason that
54
- tests that have this particular tag are being confined away from testing.
40
+ The `:tag_reason_hash` is another hash that maps tags to the reason that tests that have this particular tag are being confined away from testing.
55
41
 
56
- Taking one of our confine examples from above, we can think of the Ubuntu
57
- UI confine example like this:
42
+ Taking one of our confine examples from above, we can think of the Ubuntu UI confine example like this:
58
43
 
59
44
  "ui" tests will be confined away from ubuntu-1404 hosts, because
60
45
  "TODO: We have not applied the UI tests to Ubuntu yet"
@@ -62,15 +47,10 @@ UI confine example like this:
62
47
 
63
48
  ## But Why Do We Need These?
64
49
 
65
- Usually when we add platforms, the confining tests step is very heavy
66
- handed & repetitive, usually consisting of adding boilerplate confine
67
- calls that don't provide any explanation for why these are happening.
68
- This can make it hard to later know the reason for the confine, making
69
- it hard to know when we should be able to remove confines down the road.
50
+ Usually when we add platforms, the confining tests step is very heavy handed & repetitive, usually consisting of adding boilerplate confine calls that don't provide any explanation for why these are happening. This can make it hard to later know the reason for the confine, making it hard to know when we should be able to remove confines down the road.
70
51
 
71
- This new workflow should provide a number of advantages over the previous
72
- one, including:
52
+ This new workflow should provide a number of advantages over the previous one, including:
73
53
 
74
54
  1. Always reporting a reason for confining a platform
75
55
  2. Allowing these to be dynamically determined from configuration, rather
76
- than needing to edit tens to hundreds of test files in-repo
56
+ than needing to edit tens to hundreds of test files in-repo
@@ -2,40 +2,23 @@
2
2
 
3
3
  ## Motivation
4
4
 
5
- Often when developing acceptance tests to be run with beaker, you'll want to be
6
- able to quickly iterate on those tests in an already setup System Under Test
7
- (SUT) configuration. Beaker provides the ability to do that using its preserved
8
- hosts functionality.
5
+ Often when developing acceptance tests to be run with beaker, you'll want to be able to quickly iterate on those tests in an already setup System Under Test (SUT) configuration. Beaker provides the ability to do that using its preserved hosts functionality.
9
6
 
10
7
  ## But Is This The Right Solution?
11
8
 
12
- Many people are of the opinion that if you have to login to a SUT, then you've
13
- already failed, and that the purpose of good automation is so that you don't
14
- ever have to do this. Beaker supports a diverse group of developers and testers,
15
- and we try to remain flexible and support multiple approaches to these problems.
9
+ Many people are of the opinion that if you have to login to a SUT, then you've already failed, and that the purpose of good automation is so that you don't ever have to do this. Beaker supports a diverse group of developers and testers, and we try to remain flexible and support multiple approaches to these problems.
16
10
 
17
- Another approach you might take to debugging failed tests, during development or
18
- test runs in your Continuous Integration (CI) systems, is to archive any
19
- artifacts or log files from the SUTs, so that you can read them all from the
20
- beaker coordinator. Beaker provides a Domain-Specific Language (DSL) method to
21
- accomodate this workflow, called `archive_file_from`. Check out the
22
- [how-to article](archive_sut_files.md) on this method for details on it.
11
+ Another approach you might take to debugging failed tests, during development or test runs in your Continuous Integration (CI) systems, is to archive any artifacts or log files from the SUTs, so that you can read them all from the beaker coordinator. Beaker provides a Domain-Specific Language (DSL) method to accomodate this workflow, called `archive_file_from`. Check out the [how-to article](archive_sut_files.md) on this method for details on it.
23
12
 
24
- That being said, the preserved hosts functionality is still useful, particularly
25
- for new development. In this case, you might not be able to necessarily tell
26
- what files you might need from your SUTs, and exploration might be necessary.
13
+ That being said, the preserved hosts functionality is still useful, particularly for new development. In this case, you might not be able to necessarily tell what files you might need from your SUTs, and exploration might be necessary.
27
14
 
28
15
  ## How Do I Use It?
29
16
 
30
- Note that where you decide to use this option will affect its precedence. You
31
- can learn more about this in our
32
- [argument processing & precedence doc](../concepts/argument_processing_and_precedence.md).
17
+ Note that where you decide to use this option will affect its precedence. You can learn more about this in our [argument processing & precedence doc](../concepts/argument_processing_and_precedence.md).
33
18
 
34
19
  ### Command-Line Option
35
20
 
36
- The primary way that this option is provided is through the command line, where
37
- it's represented by the `--preserved-hosts` option. It defaults to `never`, and
38
- if you run `beaker --help`, you'll see the range of values that can be taken:
21
+ The primary way that this option is provided is through the command line, where it's represented by the `--preserved-hosts` option. It defaults to `never`, and if you run `beaker --help`, you'll see the range of values that can be taken:
39
22
 
40
23
  $ beaker --help
41
24
  ...
@@ -50,49 +33,25 @@ if you run `beaker --help`, you'll see the range of values that can be taken:
50
33
 
51
34
  ### Local Options or Global Config
52
35
 
53
- You can also provide a value for this option wherever you can provide a value
54
- that gets merged into beaker's global options hash. The two ways to do this are
55
- to provide it in a local options file, or in the global `CONFIG` section of your
56
- hosts file. To learn more about how to set these options, check out the
57
- [Options File Values](../concepts/argument_processing_and_precedence.md#options-file-values)
58
- and the
59
- [`CONFIG` Section of a Hosts File](../concepts/argument_processing_and_precedence.md#config-section-of-hosts-file)
60
- sections of the
61
- [argument processing & precedence doc](../concepts/argument_processing_and_precedence.md).
36
+ You can also provide a value for this option wherever you can provide a value that gets merged into beaker's global options hash. The two ways to do this are to provide it in a local options file, or in the global `CONFIG` section of your hosts file. To learn more about how to set these options, check out the [Options File Values](../concepts/argument_processing_and_precedence.md#options-file-values) and the [`CONFIG` Section of a Hosts File](../concepts/argument_processing_and_precedence.md#config-section-of-hosts-file) sections of the [argument processing & precedence doc](../concepts/argument_processing_and_precedence.md).
62
37
 
63
- Either way, the underlying property name that you will have to set if you use
64
- these options is `:preserve_hosts`.
38
+ Either way, the underlying property name that you will have to set if you use these options is `:preserve_hosts`.
65
39
 
66
40
  ## What Does It Do (In Detail)?
67
41
 
68
- Using the preserved hosts functionality outputs a `hosts_preserved.yml` file into
69
- the directory that holds all of the log files for a particular beaker run. The
70
- short way to access that directory is to look into the `log/latest` path, which
71
- is a symlink to the actual log directory for the run.
42
+ Using the preserved hosts functionality outputs a `hosts_preserved.yml` file into the directory that holds all of the log files for a particular beaker run. The short way to access that directory is to look into the `log/latest` path, which is a symlink to the actual log directory for the run.
72
43
 
73
- The `hosts_preserved.yml` file generated by a run differs from the original
74
- hosts file passed into Beaker in a number of ways:
44
+ The `hosts_preserved.yml` file generated by a run differs from the original hosts file passed into Beaker in a number of ways:
75
45
 
76
- - all suites are emptied
77
- - the host names are updated to point to the IPs (or hostnames) of the VMs since
78
- they exist and no longer need provisioning
79
- - the `provision` option is set to `false` (check
80
- [Beaker Test Run's](../tutorials/test_run.md) provisioning section for details).
46
+ - all suites are emptied - the host names are updated to point to the IPs (or hostnames) of the VMs since they exist and no longer need provisioning - the `provision` option is set to `false` (check [Beaker Test Run's](../tutorials/test_run.md) provisioning section for details).
81
47
 
82
48
  Beaker will also output the lines included below at the end of the run:
83
49
 
84
50
  You can re-run commands against the already provisioned SUT(s) with:
85
51
  /.../beaker --hosts log/centos7-64mdac-ubuntu1504-64a/2016-07-18_13_42_44/hosts_preserved.yml --tests smoke_simple.rb --preserve-hosts onpass
86
52
 
87
- The important piece here is the hosts argument, in that it's informing you of
88
- where the preserved hosts file is located. Of course, until you kick off another
89
- beaker run, you can also reach this file with the `log/latest/hosts_preserved.yml`
90
- symlink, as mentioned at the beginning of this section.
53
+ The important piece here is the hosts argument, in that it's informing you of where the preserved hosts file is located. Of course, until you kick off another beaker run, you can also reach this file with the `log/latest/hosts_preserved.yml` symlink, as mentioned at the beginning of this section.
91
54
 
92
55
  ## What Do I Do With It?
93
56
 
94
- For subsequent runs, if you want to set something, you'll have to pay attention
95
- to the precedence of your arguments, to be sure that you are overriding what is
96
- set in the preserved hosts file. Checkout the
97
- [argument processing & precedence doc](../concepts/argument_processing_and_precedence.md)
98
- for more details on the precedence order of options parsing.
57
+ For subsequent runs, if you want to set something, you'll have to pay attention to the precedence of your arguments, to be sure that you are overriding what is set in the preserved hosts file. Checkout the [argument processing & precedence doc](../concepts/argument_processing_and_precedence.md) for more details on the precedence order of options parsing.
@@ -1,7 +1,5 @@
1
1
  # Rake test tasks for running beaker
2
2
 
3
- ## How does it work?
4
-
5
3
  There are some rake tasks that you can use to run Beaker tests from your local project dir.
6
4
 
7
5
  To use them from within your own project, you will need to require the following file in your project's rakefile:
@@ -20,8 +18,7 @@ from your project dir, you should see (as well as any rake tasks you have define
20
18
  rake beaker:test:git[hosts] # Run Beaker Git tests
21
19
  rake beaker:test:pe[hosts] # Run Beaker PE tests
22
20
 
23
- The last two tasks assume that you have an options file in /acceptance named beaker-git.cfg and beaker-pe.cfg
24
- respectively.
21
+ The last two tasks assume that you have an options file in `/acceptance` named `beaker-git.cfg` and `beaker-pe.cfg` respectively.
25
22
 
26
23
  Your options file would look something like:
27
24
 
@@ -3,11 +3,18 @@
3
3
  Patterns for best-use solutions to (not so) common problems
4
4
 
5
5
  ## How do i set persistent environment variables on a SUT, such as PATH?
6
+
7
+ ```ruby
6
8
  host.add_env_var('PATH', '/opt/puppetlabs/bin:$PATH')
9
+ ```
7
10
 
8
11
  ## How do i run commands on a SUT as a non-root user?
9
- (warning) this should be abstracted into a beaker helper, or part of on(): BKR-168 - Beaker::DSL::Helpers needs "as" method READY FOR ENGINEERING
10
12
 
11
- ###create the user, then su with --command:
13
+ (warning) this should be abstracted into a beaker helper, or part of `on()`: BKR-168 - Beaker::DSL::Helpers needs "as" method READY FOR ENGINEERING
14
+
15
+ Create the user, then `su` with `--command`:
16
+
17
+ ```ruby
12
18
  on(host, puppet("resource user #{username} ensure=present managehome-true"))
13
19
  on(host, "su #{username} --command '#{command}'")
20
+ ```
@@ -1,21 +1,21 @@
1
1
  # run_in_parallel global and command options
2
2
 
3
3
  ## run_in_parallel global option
4
- The run_in_parallel global option is an array with the following possible values: ['configure', 'install']
5
- It defaults to an empty array []
6
- It can be set in an options file, or overriden by the BEAKER_RUN_IN_PARALLEL environment variable
7
- example:
8
4
 
9
- export BEAKER_RUN_IN_PARALLEL=configure,install
5
+ The run_in_parallel global option is an array with the following possible values: ['configure', 'install']. It defaults to an empty array `[]`. It can be set in an options file, or overriden by the `BEAKER_RUN_IN_PARALLEL` environment variable. Example:
6
+
7
+ ```console
8
+ $ export BEAKER_RUN_IN_PARALLEL=configure,install
9
+ ```
10
10
 
11
11
  Including 'configure' causes timesync to execute in parallel (if timesync=true for any host)
12
12
 
13
13
  Including 'install' causes as much of the puppet install to happen in parallel as possible.
14
14
 
15
15
  ## run_in_parallel command option
16
- The run_in_parallel command option is a boolean value, specifying whether to execute each iteration (usually of hosts)
17
- in parallel, or not. The block_on method is the primary method accepting the run_in_parallel command option,
18
- however many methods that call into block_on respect it as well:
16
+
17
+ The run_in_parallel command option is a boolean value, specifying whether to execute each iteration (usually of hosts) in parallel, or not. The block_on method is the primary method accepting the run_in_parallel command option, however many methods that call into block_on respect it as well:
18
+
19
19
  - on
20
20
  - run_block_on
21
21
  - block_on
@@ -25,9 +25,9 @@ however many methods that call into block_on respect it as well:
25
25
  - execute_powershell_script_on
26
26
 
27
27
  ## Using InParallel in your test scripts
28
- In addition to the options, you can use InParallel within your test scripts as well.
29
28
 
30
- Examples:
29
+ In addition to the options, you can use InParallel within your test scripts as well. Examples:
30
+
31
31
  ```ruby
32
32
  include InParallel
33
33
 
@@ -1,26 +1,21 @@
1
1
  # How to Forward ssh(1) Agent
2
2
 
3
- `ssh(1)` agent forwarding can is activated in the `CONFIG` section of the hosts
4
- file:
3
+ `ssh(1)` agent forwarding can is activated in the `CONFIG` section of the hosts file:
5
4
 
6
- ~~~yaml
5
+ ```yaml
7
6
  HOSTS:
8
7
  ...
9
8
  CONFIG:
10
9
  forward_ssh_agent: true
11
- ~~~
10
+ ```
12
11
 
13
- Beaker will then make the ssh agent running on the beaker coordinator available to the Systems Under Test (SUT). There is
14
- a gotcha though: the agent socket file in the SUT is only available
15
- to the user who signed in. If you want to access remote machine resources as
16
- another user, you *must* change the socket permission.
12
+ Beaker will then make the ssh agent running on the beaker coordinator available to the Systems Under Test (SUT). There is a gotcha though: the agent socket file in the SUT is only available to the user who signed in. If you want to access remote machine resources as another user, you *must* change the socket permission.
17
13
 
18
- A dirty hack is to `chmod -R 777 /tmp/ssh-*` before changing to another user
19
- and relying on `$SSH_AUTH_SOCK`.
14
+ A dirty hack is to `chmod -R 777 /tmp/ssh-*` before changing to another user and relying on `$SSH_AUTH_SOCK`.
20
15
 
21
16
  Example:
22
17
 
23
- ~~~puppet
18
+ ```puppet
24
19
  exec { '/bin/chmod -R 777 /tmp/ssh-*':
25
20
  } ->
26
21
  vcsrepo { '/var/www/app':
@@ -28,8 +23,8 @@ vcsrepo { '/var/www/app':
28
23
  source => 'https://example.com/git/app.git',
29
24
  user => 'deploy'
30
25
  }
31
- ~~~
26
+ ```
32
27
 
33
- ## Cross SUT access
28
+ ## Cross-SUT access
34
29
 
35
30
  If you need to be able to SSH between SUTs while running Beaker acceptance tests, please refer to the [enabling cross SUT access](enabling_cross_sut_access.md) document
@@ -2,35 +2,35 @@
2
2
 
3
3
  Setting up a SSH connection to hosts can be tricky. Beaker supports three methods to SSH to hosts:
4
4
 
5
- 1. `ip`
6
- 2. `vmhostname (dns name)`
7
- 3. `hostname`
5
+ 1. `:ip`
6
+ 2. `:vmhostname` - DNS name
7
+ 3. `:hostname`
8
8
 
9
- Beaker tries to SSH to hosts using these methods in a particular preference (order). Default preference is mentioned above. We allow hypervisor authors and end users to provide an array of these methods that reflects their preference.
9
+ Beaker tries to SSH to hosts using these methods in a particular preference (order). Default preference is mentioned above. We allow hypervisor authors and end users to provide an array of these methods that reflects their preference. Note that methods are identified by Ruby symbols, not strings.
10
10
 
11
- ### Why set a preference?
11
+ ## Why set a preference?
12
12
 
13
13
  Depending upon your hypervisor, your host could have specific method that it uses to SSH better and faster than other methods. For example, hosts generated by vmpooler connects better with `vmhostname` as some change their ip adderess on restart. Therefore vmpooler hypervisor sets its connection preference to use vmhostname first.
14
14
 
15
- ### Setting SSH connection preference at hypervisor level
15
+ ## Setting SSH connection preference at hypervisor level
16
16
 
17
17
  Hypervisor authors can set SSH connection preference. The only thing they have to do is override the `connection_preference` method set in [hypervisor.rb](https://github.com/puppetlabs/beaker/blob/master/lib/beaker/hypervisor.rb) file in their own hypervisor file.
18
18
 
19
19
  For example, `beaker-vmpooler` overriding this in [vmpooler.rb](https://github.com/puppetlabs/beaker-vmpooler/blob/master/lib/beaker/hypervisor/vmpooler.rb) file.
20
20
 
21
- ### Setting SSH connection methods in hosts file
21
+ ## Setting SSH connection methods in hosts file
22
22
 
23
23
  End users can override the connection preference that is default or set by their hypervisor. This can be done from your hosts file. All you need to do is provide a `ssh_preference` for each host. The value of this key should be an array of the methods specified above in an order you prefer. Beaker then will attempt to SSH to the hosts in that particular order.
24
24
 
25
25
  Example of a host file:
26
26
 
27
- ```
27
+ ```yaml
28
28
  HOSTS:
29
29
  ubuntu1604-64-1:
30
30
  hypervisor: vmpooler
31
31
  platform: ubuntu-16.04-amd64
32
32
  template: ubuntu-1604-x86_64
33
- ssh_preference: ['vmhostname', 'hostname', 'ip']
33
+ ssh_preference: [:vmhostname, :hostname, :ip]
34
34
  roles:
35
35
  - agent
36
36
  - default
@@ -38,7 +38,7 @@ HOSTS:
38
38
  hypervisor: vmpooler
39
39
  platform: ubuntu-16.04-amd64
40
40
  template: ubuntu-1604-x86_64
41
- ssh_preference: ['ip, 'vmhostname']
41
+ ssh_preference: [:ip, :vmhostname]
42
42
  roles:
43
43
  - agent
44
44
  CONFIG:
@@ -1,12 +1,8 @@
1
1
  # Test arbitrary beaker versions without modifying test code
2
2
 
3
- In order to adjust the beaker version used without commiting a change to a Gemfile,
4
- we at Puppet often use a method in our code that changes the dependency based on the
5
- existence of ENV variables in the shell that beaker is executing from. The code
6
- itself looks like this:
3
+ In order to adjust the beaker version used without commiting a change to a Gemfile, we at Puppet often use a method in our code that changes the dependency based on the existence of ENV variables in the shell that beaker is executing from. The code itself looks like this:
7
4
 
8
5
  ```ruby
9
-
10
6
  def location_for(place, fake_version = nil)
11
7
  if place =~ /^(git[:@][^#]*)#(.*)/
12
8
  [fake_version, { :git => $1, :branch => $2, :require => false }].compact
@@ -16,11 +12,9 @@ def location_for(place, fake_version = nil)
16
12
  [place, { :require => false }]
17
13
  end
18
14
  end
19
-
20
15
  ```
21
16
 
22
- Once this method definition is in place in the Gemfile, we can call it in a gem command, like
23
- this:
17
+ Once this method definition is in place in the Gemfile, we can call it in a gem command, like this:
24
18
 
25
19
  ```ruby
26
20
 
@@ -37,10 +31,9 @@ git://github.com/puppetlabs/beaker.git#master
37
31
  ```
38
32
 
39
33
  ### file locations
34
+
40
35
  ```
41
36
  file://../relative/path/to/beaker
42
37
  ```
43
- By adjusting the shell environment that beaker is running in, we can modify what version of
44
- beaker is installed by bundler on your test coordinator without modifying any of the test
45
- code. This strategy can be used for any gem dependency, and is often used when testing
46
- [beaker libraries](../concepts/beaker_libraries.md) at Puppet.
38
+
39
+ By adjusting the shell environment that beaker is running in, we can modify what version of beaker is installed by bundler on your test coordinator without modifying any of the test code. This strategy can be used for any gem dependency, and is often used when testing [beaker libraries](../concepts/beaker_libraries.md) at Puppet.
@@ -2,23 +2,27 @@ Beaker maintains yard documentation, which covers the [Beaker DSL](http://www.ru
2
2
 
3
3
 
4
4
 
5
- ## Assertions ##
5
+ ## Assertions
6
+
6
7
  To be used for confirming the result of a test is as expected. Beaker include all Minitest assertions, plus some custom built assertions.
7
8
 
8
9
  * [Minitest assertions](http://docs.seattlerb.org/minitest/Minitest/Assertions.html)
9
10
  * [assert_output](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Assertions#assert_output-instance_method)
10
11
  * [assert_no_match](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Assertions#assert_no_match-instance_method)
11
12
 
12
- ## Helpers ##
13
+ ## Helpers
14
+
13
15
  DSL methods designed to help you interact with installed projects (like facter and puppet), with hosts (like running arbitrary commands on hosts) or interacting with the web (checking is a given URL is alive or not).
14
16
 
15
- ### Facter ###
17
+ ### Facter
18
+
16
19
  DSL methods for interacting with facter.
17
20
 
18
21
  * [fact_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/FacterHelpers#fact_on-instance_method)
19
22
  * [fact](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/FacterHelpers#fact-instance_method)
20
23
 
21
- ### Host ###
24
+ ### Host
25
+
22
26
  DSL methods for host manipulation.
23
27
 
24
28
  * [on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/HostHelpers#on-instance_method)
@@ -45,8 +49,10 @@ DSL methods for host manipulation.
45
49
  * [create_tmpdir_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/HostHelpers#create_tmpdir_on-instance_method)
46
50
  * [echo_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/HostHelpers#echo_on-instance_method)
47
51
 
48
- ### Puppet ###
52
+ ### Puppet
53
+
49
54
  DSL methods for interacting with puppet.
55
+
50
56
  * [puppet_user](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/PuppetHelpers#puppet_user-instance_method)
51
57
  * [puppet_group](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/PuppetHelpers#puppet_group-instance_method)
52
58
  * [with_puppet_running_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/PuppetHelpers#with_puppet_running_on-instance_method)
@@ -78,13 +84,15 @@ DSL methods for interacting with puppet.
78
84
  * [sign_certificate](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/PuppetHelpers#sign_certificate-instance_method)
79
85
  * [create_tmpdir_for_user](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/PuppetHelpers#create_tmpdir_for_user-instance_method)
80
86
 
81
- ### TK ###
87
+ ### TK
88
+
82
89
  Convenience methods for TrapperKeeper configuration.
83
90
 
84
91
  * [modify_tk_config](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/TkHelpers#modify_tk_config-instance_method)
85
92
  * [read_tk_config_string](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/TkHelpers#read_tk_config_string-instance_method)
86
93
 
87
- ### Web ###
94
+ ### Web
95
+
88
96
  Helpers for web actions.
89
97
 
90
98
  * [port_open_within?](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/WebHelpers#port_open_within?-instance_method)
@@ -92,7 +100,8 @@ Helpers for web actions.
92
100
  * [fetch_http_file](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/WebHelpers#fetch_http_file-instance_method)
93
101
  * [fetch_http_dir](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/WebHelpers#fetch_http_dir-instance_method)
94
102
 
95
- ### Test ###
103
+ ### Test
104
+
96
105
  DSL methods for setting information about the current test.
97
106
 
98
107
  * [current_test_name](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/TestHelpers#current_test_name-instance_method)
@@ -102,11 +111,14 @@ DSL methods for setting information about the current test.
102
111
  * [set_current_test_filename](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/TestHelpers#set_current_test_filename-instance_method)
103
112
  * [set_current_step_name](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Helpers/TestHelpers#set_current_step_name-instance_method)
104
113
 
105
- ## Install Utilities ##
114
+ ## Install Utilities
115
+
106
116
  DSL methods for installing PuppetLabs projects.
107
117
 
108
- ### EZBake ###
118
+ ### EZBake
119
+
109
120
  EZBake convenience methods.
121
+
110
122
  * [install_from_ezbake](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/EzbakeUtils#install_from_ezbake-instance_method)
111
123
  * [install_termini_from_ezbake](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/EzbakeUtils#install_termini_from_ezbake-instance_method)
112
124
  * [ezbake_dev_build](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/EzbakeUtils#ezbake_dev_build-instance_method)
@@ -122,7 +134,8 @@ EZBake convenience methods.
122
134
  * [ezbake_installsh](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/EzbakeUtils#ezbake_installsh-instance_method)
123
135
  * [conditionally_clone](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/EzbakeUtils#conditionally_clone-instance_method)
124
136
 
125
- ### AIO ###
137
+ ### AIO
138
+
126
139
  Agent-only installation utilities.
127
140
 
128
141
  * [add_platform_aio_defaults](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/AIODefaults#add_platform_aio_defaults-instance_method)
@@ -130,7 +143,8 @@ Agent-only installation utilities.
130
143
  * [remove_platform_aio_defaults](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/AIODefaults#remove_platform_aio_defaults-instance_method)
131
144
  * [remove_aio_defaults_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/AIODefaults#remove_aio_defaults_on-instance_method)
132
145
 
133
- ### FOSS ###
146
+ ### FOSS
147
+
134
148
  DSL methods for installing FOSS PuppetLabs projects.
135
149
 
136
150
  * [add_platform_foss_defaults](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/FOSSDefaults#add_platform_foss_defaults-instance_method)
@@ -167,7 +181,8 @@ DSL methods for installing FOSS PuppetLabs projects.
167
181
  * [install_puppet_agent_pe_promoted_repo_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/FOSSUtils#install_puppet_agent_pe_promoted_repo_on-instance_method)
168
182
  * [install_cert_on_windows](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/FOSSUtils#install_cert_on_windows-instance_method)
169
183
 
170
- ### PE ###
184
+ ### PE
185
+
171
186
  DSL methods for installing Puppet Enterprise.
172
187
 
173
188
  * [add_platform_pe_defaults](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/PeDefaults#add_platform_pe_defaults-instance_method)
@@ -193,7 +208,8 @@ DSL methods for installing Puppet Enterprise.
193
208
  * [install_higgs](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/PeUtils#install_higgs-instance_method)
194
209
  * [fetch_and_push_pe](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/PeUtils#fetch_and_push_pe-instance_method)
195
210
 
196
- ### Puppet ###
211
+ ### Puppet
212
+
197
213
  DSL methods that can be used for both FOSS/PE puppet installations.
198
214
 
199
215
  * [normalize_type](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/PuppetUtils#normalize_type-instance_method)
@@ -204,7 +220,8 @@ DSL methods that can be used for both FOSS/PE puppet installations.
204
220
  * [configure_type_defaults_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/PuppetUtils#configure_type_defaults_on-instance_method)
205
221
  * [remove_defaults_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/PuppetUtils#remove_defaults_on-instance_method)
206
222
 
207
- ### Windows ###
223
+ ### Windows
224
+
208
225
  DSL convenience methods for installing packages on Windows SUTs.
209
226
 
210
227
  * [get_temp_path](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/WindowsUtils#get_temp_path-instance_method)
@@ -212,7 +229,8 @@ DSL convenience methods for installing packages on Windows SUTs.
212
229
  * [create_install_msi_batch_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/WindowsUtils#create_install_msi_batch_on-instance_method)
213
230
  * [install_msi_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/WindowsUtils#install_msi_on-instance_method)
214
231
 
215
- ### Module ###
232
+ ### Module
233
+
216
234
  DSL methods for installing puppet modules.
217
235
 
218
236
  * [install_dev_puppet_module_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/ModuleUtils#install_dev_puppet_module_on-instance_method)
@@ -226,7 +244,8 @@ DSL methods for installing puppet modules.
226
244
  * [split_author_modulename](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/ModuleUtils#split_author_modulename-instance_method)
227
245
  * [build_ignore_list](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/ModuleUtils#build_ignore_list-instance_method)
228
246
 
229
- ## Outcomes ##
247
+ ## Outcomes
248
+
230
249
  Methods that indicate how the given test completed (fail, pass, skip or pending).
231
250
 
232
251
  * [fail_test](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Outcomes#fail_test-instance_method)
@@ -235,12 +254,14 @@ Methods that indicate how the given test completed (fail, pass, skip or pending)
235
254
  * [skip_test](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Outcomes#skip_test-instance_method)
236
255
  * [formatted_message](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Outcomes#formatted_message-instance_method)
237
256
 
238
- ## Patterns ##
257
+ ## Patterns
258
+
239
259
  Shared methods used as building blocks of other DSL methods.
240
260
 
241
261
  * [block_on](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Patterns#block_on-instance_method)
242
262
 
243
- ## Roles ##
263
+ ## Roles
264
+
244
265
  DSL methods for accessing hosts of various roles.
245
266
 
246
267
  * [agents](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Roles#agents-instance_method)
@@ -260,7 +281,8 @@ DSL methods for accessing hosts of various roles.
260
281
  * [find_only_one](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Roles#find_only_one-instance_method)
261
282
  * [find_at_most_one](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Roles#find_at_most_one-instance_method)
262
283
 
263
- ## Structure ##
284
+ ## Structure
285
+
264
286
  DSL methods that describe and define how a test is executed.
265
287
 
266
288
  * [step](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Structure#step-instance_method)
@@ -273,7 +295,8 @@ DSL methods that describe and define how a test is executed.
273
295
  * [select_hosts](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Structure#select_hosts-instance_method)
274
296
  * [inspect_host](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Structure#inspect_host-instance_method)
275
297
 
276
- ## Wrappers ##
298
+ ## Wrappers
299
+
277
300
  Wrappers around commonly used commands.
278
301
 
279
302
  * [facter](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/Wrappers#facter-instance_method)