beaker 2.27.0 → 2.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +8 -8
  2. data/HISTORY.md +378 -2
  3. data/README.md +1 -3
  4. data/acceptance/config/acceptance-options.rb +3 -0
  5. data/acceptance/fixtures/files/failing_shell_script.txt +3 -0
  6. data/acceptance/fixtures/files/retry_script.txt +14 -0
  7. data/acceptance/fixtures/files/shell_script_with_output.txt +3 -0
  8. data/acceptance/fixtures/files/simple_text_file.txt +3 -0
  9. data/acceptance/fixtures/files/sles-11-x86_64.repo +5 -0
  10. data/acceptance/lib/helpers/test_helper.rb +111 -0
  11. data/acceptance/tests/base/dsl/helpers/configuration_test.rb +17 -0
  12. data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +50 -0
  13. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +64 -0
  14. data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +100 -0
  15. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +201 -0
  16. data/acceptance/tests/base/dsl/helpers/host_helpers/create_tmpdir_on_test.rb +68 -0
  17. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +48 -0
  18. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +28 -0
  19. data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +142 -0
  20. data/acceptance/tests/base/dsl/helpers/host_helpers/echo_on_test.rb +13 -0
  21. data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +67 -0
  22. data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +109 -0
  23. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +42 -0
  24. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +143 -0
  25. data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +242 -0
  26. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +69 -0
  27. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +53 -0
  28. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +53 -0
  29. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +54 -0
  30. data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +51 -0
  31. data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +92 -0
  32. data/acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb +47 -0
  33. data/acceptance/tests/base/{host.rb → host_test.rb} +2 -0
  34. data/acceptance/tests/hypervisor/{communication.rb → communication_test.rb} +0 -0
  35. data/acceptance/tests/load_path_bootstrap.rb +10 -0
  36. data/acceptance/tests/puppet/{install_smoke.rb → install_smoke_test.rb} +0 -0
  37. data/beaker.gemspec +1 -1
  38. data/docs/Access-the-Live-Test-Console-with-Pry.md +305 -0
  39. data/docs/Argument-Processing-and-Precedence.md +325 -0
  40. data/docs/Beaker-Installation.md +59 -0
  41. data/docs/Beaker-Owners-and-Reviewers.md +16 -0
  42. data/docs/Beaker-Test-Tagging.md +76 -0
  43. data/docs/Beaker-with-Masterless-Puppet.md +42 -0
  44. data/docs/Creating-A-Test-Environment.md +91 -0
  45. data/docs/Docker-Support.md +129 -0
  46. data/docs/EC2-Support.md +77 -0
  47. data/docs/Example-Vagrant-Hosts-Files.md +66 -0
  48. data/docs/File-a-Beaker-Bug.md +3 -0
  49. data/docs/Google-Compute-Engine-Support.md +41 -0
  50. data/docs/How-To-Beaker.md +7 -0
  51. data/docs/How-To-Use-User-Password-Authentication-with-Beaker.md +53 -0
  52. data/docs/How-to-Write-a-Beaker-Test-for-a-Module.md +145 -0
  53. data/docs/Lets-Write-a-Test.md +73 -0
  54. data/docs/Openstack-Support.md +32 -0
  55. data/docs/Overview.md +31 -0
  56. data/docs/README.md +43 -0
  57. data/docs/Roles-What-Are-They.md +44 -0
  58. data/docs/Shared-Options-for-Executing-Beaker-Commands.md +43 -0
  59. data/docs/Solaris-Support.md +10 -0
  60. data/docs/The-Beaker-DSL.md +283 -0
  61. data/docs/The-Command-Line.md +24 -0
  62. data/docs/Types,-Puppet-4,-and-the-All-In-One-Agent.md +13 -0
  63. data/docs/VMWare-Fusion-Support.md +36 -0
  64. data/docs/Vagrant-Support.md +47 -0
  65. data/docs/beaker-vs.-beaker-rspec.md +87 -0
  66. data/docs/hosts/README.md +8 -0
  67. data/docs/hosts/eos.md +30 -0
  68. data/docs/hypervisors/README.md +8 -0
  69. data/docs/hypervisors/aws.md +143 -0
  70. data/docs/vSphere-Support.md +46 -0
  71. data/lib/beaker/dsl/helpers/host_helpers.rb +2 -4
  72. data/lib/beaker/dsl/helpers/puppet_helpers.rb +45 -11
  73. data/lib/beaker/dsl/install_utils/foss_utils.rb +20 -23
  74. data/lib/beaker/dsl/install_utils/module_utils.rb +4 -0
  75. data/lib/beaker/dsl/install_utils/pe_utils.rb +2 -6
  76. data/lib/beaker/dsl/patterns.rb +1 -1
  77. data/lib/beaker/host.rb +3 -0
  78. data/lib/beaker/host/eos.rb +56 -0
  79. data/lib/beaker/host/mac/pkg.rb +1 -1
  80. data/lib/beaker/host/unix/pkg.rb +36 -0
  81. data/lib/beaker/hypervisor/aws_sdk.rb +1 -1
  82. data/lib/beaker/hypervisor/vagrant.rb +3 -3
  83. data/lib/beaker/logger.rb +1 -0
  84. data/lib/beaker/options/presets.rb +5 -0
  85. data/lib/beaker/shared/host_manager.rb +7 -4
  86. data/lib/beaker/version.rb +1 -1
  87. data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +87 -0
  88. data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +53 -20
  89. data/spec/beaker/dsl/install_utils/module_utils_spec.rb +1 -1
  90. data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +7 -14
  91. data/spec/beaker/host/eos_spec.rb +65 -0
  92. data/spec/beaker/host/unix/pkg_spec.rb +42 -0
  93. data/spec/beaker/hypervisor/aws_sdk_spec.rb +17 -56
  94. data/spec/beaker/hypervisor/vagrant_spec.rb +1 -1
  95. data/spec/beaker/logger_spec.rb +1 -1
  96. data/spec/mocks.rb +0 -13
  97. metadata +76 -6
  98. data/acceptance/tests/dsl/install_utils/clone_git_repo_on.rb +0 -50
@@ -0,0 +1,7 @@
1
+ * [Overview](Overview.md)
2
+ * [Beaker Installation](Beaker-Installation.md)
3
+ * [Creating A Test Environment](Creating-A-Test-Environment.md)
4
+ * [The Command Line](The-Command-Line.md)
5
+ * [The Beaker DSL](The-Beaker-DSL.md)
6
+ * [Let's Write a Test!](Lets-Write-a-Test.md)
7
+ * [Access The Live Test Console with Pry](Access-the-Live-Test-Console-with-Pry.md)
@@ -0,0 +1,53 @@
1
+ By default Beaker connects to hosts using public key authentication, but that may not be correct method for your particular testing set up. To have beaker connect to a host using a username/password combination edit your hosts configuration file. You will need to create a new ssh hash to be used for logging into your SUT that includes (at least) entries for _user_, _password_, and _auth_method_. You may also include any additional supported [Net::SSH Options](http://net-ssh.github.io/ssh/v1/chapter-2.html#s3).
2
+
3
+ ## Example 1: Use 'password' authentication
4
+ ```
5
+ HOSTS:
6
+ pe-centos6:
7
+ roles:
8
+ - master
9
+ - agent
10
+ - dashboard
11
+ - database
12
+ - myrole
13
+ platform: el-6-i386
14
+ snapshot : clean-w-keys
15
+ hypervisor : fusion
16
+ ssh:
17
+ password : anode
18
+ user: anode
19
+ auth_methods:
20
+ - password
21
+ ```
22
+
23
+ The log will then read as:
24
+
25
+ _snip_
26
+ ```
27
+ pe-centos6 20:19:16$ echo hello!
28
+ Attempting ssh connection to pe-centos6, user: anode, opts: {:config=>false, :paranoid=>false, :timeout=>300, :auth_methods=>["password"], :port=>22, :forward_agent=>true, :keys=>["/Users/anode/.ssh/id_rsa"], :user_known_hosts_file=>"/Users/anode/.ssh/known_hosts", :password=>"anode", :user=>"anode"}
29
+ ```
30
+ _/snip_
31
+
32
+ ## Example 2: Use a list of authentication methods
33
+ If you want to try a sequence of authentication techniques that fall through on failure simply include them (in their desired order) in your list of _auth_methods_. If one of your methods is user/password be warned, after a failure Net::SSH will attempt keyboard-interactive password entry - if you do not want this behavior add _number_of_password_prompts: 0_.
34
+ ```
35
+ HOSTS:
36
+ pe-centos6:
37
+ roles:
38
+ - master
39
+ - agent
40
+ - dashboard
41
+ - database
42
+ - myrole
43
+ platform: el-6-i386
44
+ snapshot : clean-w-keys
45
+ hypervisor : fusion
46
+ CONFIG:
47
+ ssh:
48
+ auth_methods:
49
+ - password
50
+ - publickey
51
+ number_of_password_prompts: 0
52
+ password : wootwoot
53
+ ```
@@ -0,0 +1,145 @@
1
+ #Beaker for Modules
2
+ ##Read the Beaker Docs
3
+
4
+ [Beaker How To](https://github.com/puppetlabs/beaker/wiki)
5
+
6
+ <a href = "http://rubydoc.info/github/puppetlabs/beaker/frames">Beaker DSL API</a>
7
+
8
+ ##Understand the Difference Between beaker and beaker-rspec
9
+ [beaker vs. beaker-rspec](https://github.com/puppetlabs/beaker/wiki/beaker-vs.-beaker-rspec)
10
+
11
+ ##beaker-rspec Details
12
+ ###Supported ENV variables
13
+
14
+ `BEAKER_debug` - turn on extended debug logging
15
+
16
+ `BEAKER_set` - set to the name of the node file to be used during testing (exclude .yml file extension, it will be added by beaker-rspec), assumed to be in module's spec/acceptance/nodesets directory
17
+
18
+ `BEAKER_setfile` - set to the full path to a node file be used during testing (be sure to include full path and file extensions, beaker-rspec will use this path without editing/altering it in any way)
19
+
20
+ `BEAKER_destroy` - set to `no` to preserve test boxes after testing, set to `onpass` to destroy only if tests pass
21
+
22
+ `BEAKER_provision` - set to `no` to skip provisioning boxes before testing, will then assume that boxes are already provisioned and reachable
23
+
24
+ ##Typical Workflow
25
+
26
+ 1. Run tests with `BEAKER_destroy=no`, no setting for `BEAKER_provision`
27
+ * beaker-rspec will use spec/acceptance/nodesets/default.yml node file
28
+ * boxes will be newly provisioned
29
+ * boxes will be preserved post-testing
30
+ * Run tests with `BEAKER_destroy=no` and `BEAKER_provision=no`
31
+ * beaker-rspec will use spec/acceptance/nodesets/default.yml node file
32
+ * boxes will be re-used from previous run
33
+ * boxes will be preserved post-testing
34
+ * Nodes become corrupted with too many test runs/bad data and need to be refreshed then GOTO step 1
35
+ * Testing is complete and you want to clean up, run once more with `BEAKER_destroy` unset
36
+ * you can also:
37
+
38
+ cd .vagrant/beaker_vagrant_files/default.yml ; vagrant destroy --force
39
+
40
+ ##Building your Module Testing Environment
41
+
42
+ Using puppetlabs-mysql as an example module.
43
+
44
+ ###Clone the module repository of the module that you wish to test
45
+
46
+ git clone https://github.com/puppetlabs/puppetlabs-mysql
47
+ cd puppetlabs-mysql
48
+
49
+ ###Create the spec_helper_acceptance.rb
50
+
51
+ Create example file spec_helper_acceptance.rb:
52
+ ```ruby
53
+ require 'beaker-rspec'
54
+ require 'pry'
55
+
56
+ hosts.each do |host|
57
+ # Install Puppet
58
+ on host, install_puppet
59
+ end
60
+
61
+ RSpec.configure do |c|
62
+ module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
63
+
64
+ c.formatter = :documentation
65
+
66
+ # Configure all nodes in nodeset
67
+ c.before :suite do
68
+ # Install module
69
+ puppet_module_install(:source => module_root, :module_name => 'mysql')
70
+ hosts.each do |host|
71
+ on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
72
+ end
73
+ end
74
+ end
75
+ ```
76
+
77
+ Update spec_helper_acceptance.rb to reflect the module under test. You will need to set the correct module name and add any module dependencies. Place the file in the /spec directory (in this case puppetlabs-mysql/spec)
78
+
79
+ ###Install beaker-rspec
80
+ ####From Gem (preferred)
81
+
82
+ gem install beaker-rspec
83
+
84
+ ###Update the module's Gemfile
85
+
86
+ In module's top level directory edit Gemfile.
87
+
88
+ Add `gem 'beaker-rspec', :require => false` under `group :development, :test do`.
89
+
90
+ bundle install
91
+
92
+ ###Create node files
93
+
94
+ These files indicate the nodes (or hosts) that the tests will be run on. By default, any node file called `default.yml` will be used. You can override this using the `BEAKER_set` environment variable to indicate an alternate file. Do not provide full path or the '.yml' file extension to `BEAKER_set`, it is assumed to be located in 'spec/acceptance/nodesets/${NAME}.yml' by beaker-rspec. If you wish to use a completely different file location use `BEAKER_setfile` and set it to the full path (including file extension) of your hosts file.
95
+
96
+ Nodes are pulled from <a href = "https://vagrantcloud.com/puppetlabs">Puppet Labs Vagrant Boxes</a>.
97
+
98
+ Example node files can be found here:
99
+
100
+ *[Puppet Labs example Vagrant node files](Example-Vagrant-Hosts-Files.md)
101
+
102
+ Create the nodesets directory. From module's top level directory:
103
+
104
+ mkdir -p spec/acceptance/nodesets
105
+
106
+ Copy any nodesets that you wish to use into the nodesets directory.
107
+
108
+ ###Create spec tests for your module
109
+
110
+ Spec tests are written in <a href = "http://rspec.info/">RSpec</a>.
111
+
112
+ Example spec file (mysql_account_delete_spec.rb):
113
+
114
+ ```ruby
115
+ require 'spec_helper_acceptance'
116
+
117
+ describe 'mysql::server::account_security class' do
118
+ describe 'running puppet code' do
119
+ it 'should work with no errors' do
120
+ pp = <<-EOS
121
+ class { 'mysql::server': remove_default_accounts => true }
122
+ EOS
123
+
124
+ # Run it twice and test for idempotency
125
+ apply_manifest(pp, :catch_failures => true)
126
+ expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
127
+ end
128
+
129
+ describe 'accounts' do
130
+ it 'should delete accounts' do
131
+ shell("mysql -e 'show grants for root@127.0.0.1;'", :acceptable_exit_codes => 1)
132
+ end
133
+
134
+ it 'should delete databases' do
135
+ shell("mysql -e 'show databases;' |grep test", :acceptable_exit_codes => 1)
136
+ end
137
+ end
138
+ end
139
+ end
140
+ ```
141
+ ###Run your spec tests
142
+
143
+ From module's top level directory
144
+
145
+ bundle exec rspec spec/acceptance
@@ -0,0 +1,73 @@
1
+ ###The Task
2
+
3
+ Consider if mcollectived incorrectly spawned a new process with every puppet agent run on Ubuntu 10.04. We need an acceptance test to check that a new process is not spawned and to ensure that this issue does not regress in new builds.
4
+
5
+ ###Figure Out Test Steps
6
+
7
+ What needs to happen in this test:
8
+
9
+ * Install PE
10
+ * Restart mcollective twice
11
+ * Check to see if more than one mcollective process is running
12
+
13
+ ###Install PE
14
+
15
+ We prefer to install PE once and then run a set of tests, so PE installation should not be part of the actual acceptance test.
16
+
17
+ $ mkdir setup
18
+ $ cd setup
19
+ $ cat > install.rb << RUBY
20
+ test_name "Installing Puppet Enterprise" do
21
+ install_pe
22
+ RUBY
23
+ $ cd ..
24
+
25
+ XXX - Will beaker just pick this up? Is the setup dir magic?
26
+
27
+ ## Create a test file
28
+
29
+ We need to create a test file to run.
30
+
31
+ ### Define some test commands to run
32
+ ####Restart mcollective twice
33
+
34
+ Here's our magic command that restarts mcollective:
35
+
36
+ restart_command = "bash -c '[[ -x /etc/init.d/pe-mcollective ]] && /etc/init.d/pe-mcollective restart'"
37
+
38
+ ####Check to see if more than one mcollective process is running
39
+
40
+ Here's our magic command that throws an error if more than one mcollective process is running:
41
+ ```
42
+ process_count_check = "bash -c '[[ $(ps auxww | grep [m]collectived | wc -l) -eq 1 ]]'"
43
+ ```
44
+ ###Put it all together
45
+
46
+ Here's the finished acceptance test.
47
+ ```
48
+ test_name "/etc/init.d/pe-mcollective restart check"
49
+
50
+ # Don't run these tests on the following platforms
51
+ confine :except, :platform => 'solaris'
52
+ confine :except, :platform => 'windows'
53
+ confine :except, :platform => 'aix'
54
+
55
+ step "Make sure the service restarts properly"
56
+ hosts.each do |host|
57
+ # Commands to execute on the target system.
58
+ restart_command = "bash -c '[[ -x /etc/init.d/pe-mcollective ]] && /etc/init.d/pe-mcollective restart'"
59
+ process_count_check = "bash -c '[[ $(ps auxww | grep [m]collectived | wc -l) -eq 1 ]]'"
60
+
61
+ # Restart once
62
+ on(host, restart_command) { assert_equal(0, exit_code) }
63
+ # Restart again
64
+ on(host, restart_command) { assert_equal(0, exit_code) }
65
+ # Check to make sure only one process is running
66
+ on(host, process_count_check) { assert_equal(0, exit_code) }
67
+ end
68
+ ```
69
+ You can now run this with
70
+
71
+ `beaker --host myhost.cfg --test mytest.rb`
72
+
73
+ Next up you may want to look at the [Beaker test for a module](How-to-Write-a-Beaker-Test-for-a-Module.md) page.
@@ -0,0 +1,32 @@
1
+ This options allows for testing against Openstack instances.
2
+
3
+ Considered **EXPERIMENTAL**, may break without notice.
4
+
5
+ ### Basic Openstack hosts file ###
6
+ HOSTS:
7
+ centos-6-master:
8
+ roles:
9
+ - master
10
+ - agent
11
+ - database
12
+ - dashboard
13
+ platform: el-6-x86_64
14
+ image: centos-6-x86_64-nocm
15
+ flavor: m1.large
16
+ hypervisor: openstack
17
+ centos-6-agent:
18
+ roles:
19
+ - agent
20
+ platform: el-6-x86_64
21
+ image: centos-6-x86_64-nocm
22
+ flavor: m1.large
23
+ hypervisor: openstack
24
+ CONFIG:
25
+ nfs_server: none
26
+ consoleport: 443
27
+ openstack_api_key: P1as$w0rd
28
+ openstack_username: user
29
+ openstack_auth_url: http://10.10.10.10:5000/v2.0/tokens
30
+ openstack_tenant: testing
31
+ openstack_network : testing
32
+ openstack_keyname : nopass
@@ -0,0 +1,31 @@
1
+ Beaker is an acceptance testing harness for Puppet PE and other Puppet Projects. It can also be used as a virtual machine provisioner - setting up machines, running any configuration on those machines and then exiting.
2
+
3
+ Beaker goes through several phases when running tests
4
+
5
+ * Provisioning
6
+ * skip with `--no-provision`
7
+ * Using supported hypervisors provision SUTs for testing on
8
+ * Do any initial configuration to ensure that the SUTs can communicate with beaker and each other
9
+ * Validation
10
+ * skip with `--no-validate`
11
+ * Check the SUTs for necessary packages (curl, ntpdate)
12
+ * Configuration
13
+ * skip with `--no-configure`
14
+ * Do any post-provisioning configuration to the test nodes
15
+ * Testing
16
+ * Pre-Suite
17
+ * use `--pre-suite`
18
+ * Run any test files defined as part of the `--pre-suite` command line option
19
+ * Tests
20
+ * use `--tests`
21
+ * Run any test files defined as part of the `--tests` command line option
22
+ * Post-Suite
23
+ * use `--post-suite`
24
+ * Run any test files defined as part of the `--post-suite` command line option
25
+ * Reverting
26
+ * Skip with `--preserve-hosts`
27
+ * Destroy and cleanup all SUTs
28
+ * Cleanup
29
+ * Report test results
30
+
31
+ Beaker runs tests written in Ruby with an additional DSL API. This gives you access to all standard Ruby along with acceptance testing specific commands.
@@ -0,0 +1,43 @@
1
+ ![Beaker Muppet Image](http://images4.wikia.nocookie.net/__cb20101015151248/muppet/images/0/05/Beaker.jpg)
2
+
3
+ ## Beaker Info
4
+
5
+ * [Beaker Owners & Reviewers](Beaker-Owners-and-Reviewers.md)
6
+ * [How to install](Beaker-Installation.md)
7
+ * [How to Beaker](How-To-Beaker.md)
8
+ * [Overview](Overview.md)
9
+ * [Beaker Installation](Beaker-Installation.md)
10
+ * [Creating A Test Environment](Creating-A-Test-Environment.md)
11
+ * [Roles, What Are They?](Roles-What-Are-They.md)
12
+ * Supported Virtualization Techniques
13
+ * [VMWare Fusion](VMWare-Fusion-Support.md)
14
+ * [EC2](EC2-Support.md)
15
+ * [vSphere](vSphere-Support.md)
16
+ * [Vagrant](Vagrant-Support.md)
17
+ * [Example Vagrant Hosts Files](Example-Vagrant-Hosts-Files.md)
18
+ * [Google Compute Engine](Google-Compute-Engine-Support.md)
19
+ * [Docker Support](Docker-Support.md)
20
+ * [Openstack](Openstack-Support.md)
21
+ * [Solaris](Solaris-Support.md)
22
+ * [The Command Line](The-Command-Line.md)
23
+ * [Argument Processing and Precedence](Argument-Processing-and-Precedence.md)
24
+ * [How To Use User/Password Authentication with Beaker](How-To-Use-User-Password-Authentication-with-Beaker.md)
25
+ * [Running Masterless Beaker](Beaker-with-Masterless-Puppet.md)
26
+ * [Types, Puppet 4, & The All-In-One Agent](Types,-Puppet-4,-and-the-All-In-One-Agent.md)
27
+ * [The Beaker DSL](The-Beaker-DSL.md)
28
+ * [Shared Options for Executing Beaker Commands](Shared-Options-for-Executing-Beaker-Commands.md)
29
+ * [Beaker DSL on rdoc.info](http://rdoc.info/github/puppetlabs/beaker/master/Beaker/DSL)
30
+ * [Let's Write a Test!](Lets-Write-a-Test.md)
31
+ * [Access The Live Test Console with Pry](Access-the-Live-Test-Console-with-Pry.md)
32
+ * [Test Tagging](Beaker-Test-Tagging.md)
33
+ * [Beaker vs. Beaker-rspec](https://github.com/puppetlabs/beaker/wiki/beaker-vs.-beaker-rspec)
34
+ * [How to Write a Beaker Test for a Module Using beaker-rspec](How-to-Write-a-Beaker-Test-for-a-Module.md)
35
+
36
+ ## Other Resources
37
+
38
+ * [Latest Gem Release Notes](https://github.com/puppetlabs/beaker/blob/master/HISTORY.md#LATEST)
39
+ * [File a Beaker Bug](File-a-Beaker-Bug.md)
40
+ * [Video: Beaker 101 talk at PDXPUG, May 2014](https://www.youtube.com/watch?v=cSyJXTYFXFg)
41
+ * [Podcast: Beaker, May 2014](http://puppetlabs.com/podcasts/podcast-beaker-cloud-enabled-acceptance-testing-tool)
42
+ * [Podcast: Automated Testing with Beaker for Windows, December 2014](http://puppetlabs.com/podcasts/podcast-automated-testing-beaker-windows)
43
+ * [Real-world Examples: Puppetlabs Acceptance Testing for Puppet](https://github.com/puppetlabs/puppet/tree/master/acceptance/tests)
@@ -0,0 +1,44 @@
1
+ Each host in a host configuration file is defined to have one or more roles. Beaker supports the roles `master`, `agent`, `frictionless`, `dashboard` and `database`. These roles indicate what Puppet responsibilities the host will assume. If puppet is installed as part of the Beaker test execution then the roles will be honored (ie, the host defined as `master` will become the puppet master node). Other than puppet installation, the roles provide short cuts to node access. In tests you can refer to nodes by role:
2
+
3
+ on master, "echo hello"
4
+ on database, "echo hello"
5
+
6
+ ## Creating Your Own Roles
7
+ Arbitrary role creating is supported in Beaker. New roles are created as they are discovered in the host/config file provided at runtime.
8
+
9
+ ### Example User Role Creation
10
+ ```
11
+ HOSTS:
12
+ pe-ubuntu-lucid:
13
+ roles:
14
+ - agent
15
+ - dashboard
16
+ - database
17
+ - master
18
+ - nodes
19
+ - ubuntu
20
+ vmname : pe-ubuntu-lucid
21
+ platform: ubuntu-10.04-i386
22
+ snapshot : clean-w-keys
23
+ hypervisor : fusion
24
+ pe-centos6:
25
+ roles:
26
+ - agent
27
+ - nodes
28
+ - centos
29
+ vmname : pe-centos6
30
+ platform: el-6-i386
31
+ hypervisor : fusion
32
+ snapshot: clean-w-keys
33
+ CONFIG:
34
+ nfs_server: none
35
+ consoleport: 443
36
+ ```
37
+
38
+ In this case I've created the new roles `nodes`, `centos` and `ubuntu`. These roles can now be used to call any Beaker DSL methods that require a host.
39
+
40
+ ```
41
+ on centos, 'echo I'm the centos box'
42
+ on ubuntu, 'echo I'm the ubuntu box'
43
+ on nodes, 'echo this command will be executed on both defined hosts'
44
+ ```
@@ -0,0 +1,43 @@
1
+ Beaker commands are executed through an ssh connection to each individual SUT. Various options are supported during command execution that control how the commands themselves are executed, what output is generated and how results are interpreted.
2
+
3
+ ## :acceptable_exit_codes
4
+
5
+ Provide either a single or an array of acceptable/passing exit codes for the provided command. Defaults to the single exit code `0`.
6
+
7
+ on host, puppet( 'agent -t' ), :acceptable_exit_codes => [0,1,2]
8
+
9
+ ## :accept_all_exit_codes
10
+
11
+ Consider any exit codes returned by the command to be acceptable/passing. Defaults to `nil`/`false`.
12
+
13
+ on host, puppet( 'agent -t' ), :accept_all_exit_codes => true
14
+
15
+ ## :expect_connection_failure
16
+
17
+ Assume that this command will cause a connection failure. Used for `host.reboot` so that Beaker can handle the broken ssh connection.
18
+
19
+ on host, "reboot", {:expect_connection_failure => true}
20
+
21
+ ## :dry_run
22
+
23
+ Do not actually execute this command on the SUT. Defaults to `false`.
24
+
25
+ on host, "don't do this crazy thing", {:dry_run => true}
26
+
27
+ ## :pty
28
+
29
+ Should this command be executed in a pseudoterminal? Defaults to `false`.
30
+
31
+ on host, "sudo su -c \"service ssh restart\"", {:pty => true})
32
+
33
+ ## :silent
34
+
35
+ Do not output any logging for this command. Defaults to `false`.
36
+
37
+ on host, "echo hello", {:silent => true}
38
+
39
+ ## :stdin
40
+
41
+ Specifies standard input to be provided to the command post execution. Defaults to `nil`.
42
+
43
+ on host, "this command takes input", {:stdin => "hiya"}