beaker 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/beaker/answers/version30.rb +1 -1
- data/lib/beaker/cli.rb +13 -2
- data/lib/beaker/dsl/helpers.rb +6 -6
- data/lib/beaker/dsl/install_utils.rb +18 -5
- data/lib/beaker/host/unix.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +1 -1
- data/lib/beaker/host/windows/pkg.rb +3 -3
- data/lib/beaker/host_prebuilt_steps.rb +6 -6
- data/lib/beaker/hypervisor.rb +3 -3
- data/lib/beaker/hypervisor/blimper.rb +3 -3
- data/lib/beaker/hypervisor/docker.rb +4 -8
- data/lib/beaker/hypervisor/fusion.rb +3 -3
- data/lib/beaker/hypervisor/google_compute.rb +17 -7
- data/lib/beaker/hypervisor/google_compute_helper.rb +1 -1
- data/lib/beaker/hypervisor/solaris.rb +1 -1
- data/lib/beaker/hypervisor/vagrant.rb +1 -1
- data/lib/beaker/hypervisor/vcloud.rb +1 -1
- data/lib/beaker/hypervisor/vcloud_pooled.rb +3 -3
- data/lib/beaker/hypervisor/vsphere.rb +1 -1
- data/lib/beaker/logger.rb +14 -14
- data/lib/beaker/network_manager.rb +5 -5
- data/lib/beaker/options/command_line_parser.rb +12 -13
- data/lib/beaker/options/hosts_file_parser.rb +1 -1
- data/lib/beaker/options/options_file_parser.rb +4 -4
- data/lib/beaker/options/parser.rb +11 -5
- data/lib/beaker/options/pe_version_scraper.rb +2 -2
- data/lib/beaker/platform.rb +4 -4
- data/lib/beaker/shared/error_handler.rb +2 -2
- data/lib/beaker/shared/host_role_parser.rb +7 -7
- data/lib/beaker/ssh_connection.rb +2 -2
- data/lib/beaker/test_suite.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/hypervisor/docker_spec.rb +19 -13
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +108 -85
- metadata +2 -2
@@ -9,11 +9,11 @@ module Beaker
|
|
9
9
|
let(:full_opts) {["--hosts", "host.cfg", "--options", "opts_file", "--type", "pe", "--helper", "path_to_helper", "--load-path", "load_path", "--tests", "test1.rb,test2.rb,test3.rb", "--pre-suite", "pre_suite.rb", "--post-suite", "post_suite.rb", "--no-provision", "--preserve-hosts", "always", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--no-xml", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info"]}
|
10
10
|
|
11
11
|
it "can correctly read command line input" do
|
12
|
-
expect(parser.parse
|
12
|
+
expect(parser.parse(test_opts)).to be === {:hosts_file=>"vcloud.cfg", :log_level=>"debug", :tests=>"test.rb", :help=>true}
|
13
13
|
end
|
14
14
|
|
15
15
|
it "supports all our command line options" do
|
16
|
-
expect(parser.parse
|
16
|
+
expect(parser.parse(full_opts)).to be === {:hosts_file=>"anotherfile.cfg", :options_file=>"opts_file", :type=>"pe", :helper=>"path_to_helper", :load_path=>"load_path", :tests=>"test1.rb,test2.rb,test3.rb", :pre_suite=>"pre_suite.rb", :post_suite=>"post_suite.rb", :provision=>false, :preserve_hosts=>"always", :root_keys=>true, :keyfile=>"../.ssh/id_rsa", :install=>"gitrepopath", :modules=>"module", :quiet=>true, :xml=>false, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode=>"fast", :color=>false, :version=>true, :log_level=>"info"}
|
17
17
|
end
|
18
18
|
|
19
19
|
it "can produce a usage description" do
|
@@ -14,140 +14,163 @@ module Beaker
|
|
14
14
|
expect{parser.usage}.to_not raise_error
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
describe 'parse_git_repos' do
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
it "transforms arguments of <PROJECT_NAME>/<REF> to <GIT_BASE_URL>/<lowercased_project_name>#<REF>" do
|
20
|
+
opts = ["PUPPET/3.1"]
|
21
|
+
expect(parser.parse_git_repos(opts)).to be === ["#{parser.repo}/puppet.git#3.1"]
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
it "can transform --install HIERA/xyz into #{repo}/hiera.git#xyz" do
|
33
|
-
opts = ["HIERA/xyz"]
|
34
|
-
expect(parser.parse_git_repos(opts)).to be === ["#{repo}/hiera.git#xyz"]
|
35
|
-
end
|
36
|
-
it "can transform --install HIERA-PUPPET/path/to/repo into #{repo}/hiera-puppet.git#path/to/repo" do
|
37
|
-
opts = ["HIERA-PUPPET/path/to/repo"]
|
38
|
-
expect(parser.parse_git_repos(opts)).to be === ["#{repo}/hiera-puppet.git#path/to/repo"]
|
39
|
-
end
|
40
|
-
it "can transform --install PUPPET/3.1,FACTER/v.1.0 into #{repo}/puppet.git#3.1,#{repo}/facter.git#v.1.0" do
|
41
|
-
opts = ["PUPPET/3.1", "FACTER/v.1.0"]
|
42
|
-
expect(parser.parse_git_repos(opts)).to be === ["#{repo}/puppet.git#3.1", "#{repo}/facter.git#v.1.0"]
|
43
|
-
end
|
44
|
-
it "can leave --install git://github.com/puppetlabs/puppet.git#my/full/path alone" do
|
45
|
-
opts = ["git://github.com/puppetlabs/puppet.git#my/full/path"]
|
46
|
-
expect(parser.parse_git_repos(opts)).to be === ["git://github.com/puppetlabs/puppet.git#my/full/path"]
|
24
|
+
it "recognizes PROJECT_NAMEs of PUPPET, FACTER, HIERA, and HIERA-PUPPET" do
|
25
|
+
projects = [ ['puppet', 'my_branch', 'PUPPET/my_branch'],
|
26
|
+
['facter', 'my_branch', 'FACTER/my_branch'],
|
27
|
+
['hiera', 'my_branch', 'HIERA/my_branch'],
|
28
|
+
['hiera-puppet', 'my_branch', 'HIERA-PUPPET/my_branch'] ]
|
29
|
+
projects.each do |project, ref, input|
|
30
|
+
expect(parser.parse_git_repos([input])).to be === ["#{parser.repo}/#{project}.git##{ref}"]
|
31
|
+
end
|
32
|
+
end
|
47
33
|
end
|
48
34
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
35
|
+
describe 'split_arg' do
|
36
|
+
|
37
|
+
it "can split comma separated list into an array" do
|
38
|
+
arg = "file1,file2,file3"
|
39
|
+
expect(parser.split_arg(arg)).to be === ["file1", "file2", "file3"]
|
40
|
+
end
|
41
|
+
|
42
|
+
it "can use an existing Array as an acceptable argument" do
|
43
|
+
arg = ["file1", "file2", "file3"]
|
44
|
+
expect(parser.split_arg(arg)).to be === ["file1", "file2", "file3"]
|
45
|
+
end
|
46
|
+
|
47
|
+
it "can generate an array from a single value" do
|
48
|
+
arg = "i'mjustastring"
|
49
|
+
expect(parser.split_arg(arg)).to be === ["i'mjustastring"]
|
50
|
+
end
|
61
51
|
end
|
62
52
|
|
63
53
|
context 'testing path traversing', :use_fakefs => true do
|
64
|
-
let(:test_dir) { 'tmp/tests' }
|
65
54
|
|
66
|
-
let(:
|
55
|
+
let(:test_dir) { 'tmp/tests' }
|
67
56
|
let(:rb_test) { File.expand_path(test_dir + '/my_ruby_file.rb') }
|
68
57
|
let(:pl_test) { File.expand_path(test_dir + '/my_perl_file.pl') }
|
69
58
|
let(:sh_test) { File.expand_path(test_dir + '/my_shell_file.sh') }
|
70
59
|
let(:rb_other) { File.expand_path(test_dir + '/other/my_other_ruby_file.rb') }
|
71
60
|
|
72
61
|
it 'only collects ruby files as test files' do
|
73
|
-
|
74
|
-
|
62
|
+
files = [ rb_test, pl_test, sh_test, rb_other ]
|
63
|
+
create_files( files )
|
75
64
|
expect(parser.file_list([File.expand_path(test_dir)])).to be === [rb_test, rb_other]
|
76
65
|
end
|
66
|
+
|
77
67
|
it 'raises an error when no ruby files are found' do
|
78
|
-
|
79
|
-
|
68
|
+
files = [ pl_test, sh_test ]
|
69
|
+
create_files( files )
|
80
70
|
expect{parser.file_list([File.expand_path(test_dir)])}.to raise_error(ArgumentError)
|
81
71
|
end
|
72
|
+
|
82
73
|
it 'raises an error when no paths are specified for searching' do
|
83
74
|
@files = ''
|
84
75
|
expect{parser.file_list('')}.to raise_error(ArgumentError)
|
85
76
|
end
|
86
|
-
|
87
77
|
end
|
88
78
|
|
89
79
|
context 'combining split_arg and file_list maintain test file ordering', :use_fakefs => true do
|
90
|
-
let(:test_dir) { 'tmp/tests
|
91
|
-
let(:other_test_dir) {'tmp/tests2
|
80
|
+
let(:test_dir) { 'tmp/tests' }
|
81
|
+
let(:other_test_dir) {'tmp/tests2' }
|
92
82
|
|
93
83
|
before :each do
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
84
|
+
files = [
|
85
|
+
'00_EnvSetup.rb', '035_StopFirewall.rb', '05_HieraSetup.rb',
|
86
|
+
'01_TestSetup.rb', '03_PuppetMasterSanity.rb',
|
87
|
+
'06_InstallModules.rb','02_PuppetUserAndGroup.rb',
|
88
|
+
'04_ValidateSignCert.rb', '07_InstallCACerts.rb' ]
|
89
|
+
|
90
|
+
@lone_file = '08_foss.rb'
|
91
|
+
|
92
|
+
@fileset1 = files.shuffle.map {|file| test_dir + '/' + file }
|
93
|
+
@fileset2 = files.shuffle.map {|file| other_test_dir + '/' + file }
|
94
|
+
|
95
|
+
@sorted_expanded_fileset1 = @fileset1.map {|f| File.expand_path(f) }.sort
|
96
|
+
@sorted_expanded_fileset2 = @fileset2.map {|f| File.expand_path(f) }.sort
|
97
|
+
|
98
|
+
create_files( @fileset1 )
|
99
|
+
create_files( @fileset2 )
|
100
|
+
create_files( [@lone_file] )
|
99
101
|
end
|
100
102
|
|
101
103
|
it "when provided a file followed by dir, runs the file first" do
|
102
|
-
arg = "
|
103
|
-
|
104
|
+
arg = "#{@lone_file},#{test_dir}"
|
105
|
+
output = parser.file_list( parser.split_arg( arg ))
|
106
|
+
expect( output ).to be === [ @lone_file, @sorted_expanded_fileset1 ].flatten
|
104
107
|
end
|
105
108
|
|
106
109
|
it "when provided a dir followed by a file, runs the file last" do
|
107
|
-
arg = "#{test_dir}
|
108
|
-
|
110
|
+
arg = "#{test_dir},#{@lone_file}"
|
111
|
+
output = parser.file_list( parser.split_arg( arg ))
|
112
|
+
expect( output ).to be === [ @sorted_expanded_fileset1, @lone_file ].flatten
|
109
113
|
end
|
110
114
|
|
111
115
|
it "correctly orders files in a directory" do
|
112
116
|
arg = "#{test_dir}"
|
113
|
-
|
117
|
+
output = parser.file_list( parser.split_arg( arg ))
|
118
|
+
expect( output ).to be === @sorted_expanded_fileset1
|
114
119
|
end
|
115
120
|
|
116
121
|
it "when provided two directories orders each directory separately" do
|
117
122
|
arg = "#{test_dir}/,#{other_test_dir}/"
|
118
|
-
|
123
|
+
output = parser.file_list( parser.split_arg( arg ))
|
124
|
+
expect( output ).to be === @sorted_expanded_fileset1 + @sorted_expanded_fileset2
|
119
125
|
end
|
120
|
-
|
121
126
|
end
|
122
127
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
it "raises an error when a yaml file is missing" do
|
129
|
-
FakeFS.deactivate!
|
130
|
-
expect{parser.check_yaml_file("not a path")}.to raise_error(ArgumentError)
|
131
|
-
end
|
128
|
+
describe 'check_yaml_file' do
|
129
|
+
it "raises error on improperly formatted yaml file" do
|
130
|
+
FakeFS.deactivate!
|
131
|
+
expect{parser.check_yaml_file(badyaml_path)}.to raise_error(ArgumentError)
|
132
|
+
end
|
132
133
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
args = ["-h", hosts_path, "--log-level", "debug", "--type", "git", "--install", "PUPPET/1.0,HIERA/hello"]
|
138
|
-
expect(parser.parse_args(args)).to be === {:project=>"Beaker", :department=>"#{ENV['USER']}", :validate=>true, :jenkins_build_url=> "http://my.build.url/", :forge_host=>"vulcan-acceptance.delivery.puppetlabs.net", :log_level=>"debug", :trace_limit=>10, :hosts_file=>hosts_path, :options_file=>nil, :type=>"git", :provision=>true, :preserve_hosts=>'never', :root_keys=>false, :quiet=>false, :xml=>false, :color=>true, :dry_run=>false, :timeout=>300, :fail_mode=>'slow', :timesync=>false, :repo_proxy=>false, :add_el_extras=>false, :add_master_entry=>false, :consoleport=>443, :pe_dir=>"/opt/enterprise/dists", :pe_version_file=>"LATEST", :pe_version_file_win=>"LATEST-win", :dot_fog=>"#{home}/.fog", :help=>false, :ec2_yaml=>"config/image_templates/ec2.yaml", :ssh=>{:config=>false, :paranoid=>false, :timeout=>300, :auth_methods=>["publickey"], :port=>22, :forward_agent=>true, :keys=>["#{home}/.ssh/id_rsa"], :user_known_hosts_file=>"#{home}/.ssh/known_hosts"}, :install=>["git://github.com/puppetlabs/puppet.git#1.0", "git://github.com/puppetlabs/hiera.git#hello"], :HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], :vmname=>"pe-ubuntu-lucid", :platform=>"ubuntu-10.04-i386", :snapshot=>"clean-w-keys", :hypervisor=>"fusion"}, :"pe-centos6"=>{:roles=>["agent"], :vmname=>"pe-centos6", :platform=>"el-6-i386", :hypervisor=>"fusion", :snapshot=>"clean-w-keys"}}, :nfs_server=>"none", :home=>"#{home}", :answers=>{:q_puppet_enterpriseconsole_auth_user_email=>"admin@example.com", :q_puppet_enterpriseconsole_auth_password=>"~!@\#$%^*-/ aZ", :q_puppet_enterpriseconsole_smtp_host=>nil, :q_puppet_enterpriseconsole_smtp_port=>25, :q_puppet_enterpriseconsole_smtp_username=>nil, :q_puppet_enterpriseconsole_smtp_password=>nil, :q_puppet_enterpriseconsole_smtp_use_tls=>"n", :q_verify_packages=>"y", :q_puppetdb_password=>"~!@\#$%^*-/ aZ"}, :helper=>[], :load_path=>[], :tests=>[], :pre_suite=>[], :post_suite=>[], :modules=>[]}
|
134
|
+
it "raises an error when a yaml file is missing" do
|
135
|
+
FakeFS.deactivate!
|
136
|
+
expect{parser.check_yaml_file("not a path")}.to raise_error(ArgumentError)
|
137
|
+
end
|
139
138
|
end
|
140
139
|
|
141
|
-
|
142
|
-
FakeFS.deactivate!
|
143
|
-
args = ["-h", hosts_path, "--log-level", "debug", "--fail-mode", "nope"]
|
144
|
-
expect{parser.parse_args(args)}.to raise_error(ArgumentError)
|
145
|
-
end
|
140
|
+
describe 'parse_args' do
|
141
|
+
before { FakeFS.deactivate! }
|
146
142
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
143
|
+
it 'pulls the args into key called :command_line' do
|
144
|
+
my_args = [ '--log-level', 'debug', '-h', hosts_path]
|
145
|
+
expect(parser.parse_args( my_args )[:command_line]).to include(my_args.join(' '))
|
146
|
+
end
|
147
|
+
|
148
|
+
it "can correctly combine arguments from different sources" do
|
149
|
+
build_url = 'http://my.build.url/'
|
150
|
+
type = 'git'
|
151
|
+
log_level = 'debug'
|
152
|
+
|
153
|
+
old_build_url = ENV["BUILD_URL"]
|
154
|
+
ENV["BUILD_URL"] = build_url
|
155
|
+
|
156
|
+
args = ["-h", hosts_path, "--log-level", log_level, "--type", type, "--install", "PUPPET/1.0,HIERA/hello"]
|
157
|
+
output = parser.parse_args( args )
|
158
|
+
expect( output[:hosts_file] ).to be == hosts_path
|
159
|
+
expect( output[:jenkins_build_url] ).to be == build_url
|
160
|
+
expect( output[:install] ).to include( 'git://github.com/puppetlabs/hiera.git#hello' )
|
161
|
+
|
162
|
+
ENV["BUILD_URL"] = old_build_url
|
163
|
+
end
|
164
|
+
|
165
|
+
it "ensures that fail-mode is one of fast/slow" do
|
166
|
+
args = ["-h", hosts_path, "--log-level", "debug", "--fail-mode", "nope"]
|
167
|
+
expect{parser.parse_args(args)}.to raise_error(ArgumentError)
|
168
|
+
end
|
169
|
+
|
170
|
+
it "ensures that type is one of pe/git" do
|
171
|
+
args = ["-h", hosts_path, "--log-level", "debug", "--type", "unkowns"]
|
172
|
+
expect{parser.parse_args(args)}.to raise_error(ArgumentError)
|
173
|
+
end
|
151
174
|
end
|
152
175
|
|
153
176
|
describe "normalize_args" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|