beaker 2.7.1 → 2.8.0
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/HISTORY.md +121 -2
- data/lib/beaker/dsl.rb +2 -2
- data/lib/beaker/dsl/helpers.rb +13 -1429
- data/lib/beaker/dsl/helpers/facter_helpers.rb +48 -0
- data/lib/beaker/dsl/helpers/hiera_helpers.rb +71 -0
- data/lib/beaker/dsl/helpers/host_helpers.rb +506 -0
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +698 -0
- data/lib/beaker/dsl/helpers/tk_helpers.rb +101 -0
- data/lib/beaker/dsl/helpers/web_helpers.rb +115 -0
- data/lib/beaker/dsl/install_utils.rb +8 -1570
- data/lib/beaker/dsl/install_utils/ezbake_utils.rb +256 -0
- data/lib/beaker/dsl/install_utils/module_utils.rb +237 -0
- data/lib/beaker/dsl/install_utils/pe_utils.rb +518 -0
- data/lib/beaker/dsl/install_utils/puppet_utils.rb +722 -0
- data/lib/beaker/dsl/outcomes.rb +0 -4
- data/lib/beaker/dsl/roles.rb +0 -3
- data/lib/beaker/dsl/structure.rb +127 -4
- data/lib/beaker/dsl/wrappers.rb +0 -4
- data/lib/beaker/host.rb +23 -0
- data/lib/beaker/host/unix/pkg.rb +4 -4
- data/lib/beaker/host_prebuilt_steps.rb +11 -5
- data/lib/beaker/hypervisor/vagrant.rb +1 -0
- data/lib/beaker/hypervisor/vmpooler.rb +38 -0
- data/lib/beaker/logger.rb +10 -4
- data/lib/beaker/network_manager.rb +5 -4
- data/lib/beaker/options/command_line_parser.rb +7 -0
- data/lib/beaker/shared.rb +2 -1
- data/lib/beaker/shared/semvar.rb +41 -0
- data/lib/beaker/test_suite.rb +20 -6
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/facter_helpers_spec.rb +59 -0
- data/spec/beaker/dsl/helpers/hiera_helpers_spec.rb +96 -0
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +413 -0
- data/spec/beaker/dsl/{helpers_spec.rb → helpers/puppet_helpers_spec.rb} +2 -611
- data/spec/beaker/dsl/helpers/tk_helpers_spec.rb +83 -0
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +60 -0
- data/spec/beaker/dsl/install_utils/module_utils_spec.rb +241 -0
- data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +475 -0
- data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +523 -0
- data/spec/beaker/dsl/structure_spec.rb +108 -0
- data/spec/beaker/host_prebuilt_steps_spec.rb +44 -0
- data/spec/beaker/host_spec.rb +41 -0
- data/spec/beaker/hypervisor/vagrant_spec.rb +2 -1
- data/spec/beaker/logger_spec.rb +9 -2
- data/spec/beaker/network_manager_spec.rb +7 -1
- data/spec/beaker/options/command_line_parser_spec.rb +3 -2
- data/spec/beaker/shared/semvar_spec.rb +36 -0
- data/spec/beaker/test_suite_spec.rb +48 -0
- data/spec/mocks.rb +10 -0
- metadata +23 -5
- data/lib/beaker/dsl/ezbake_utils.rb +0 -259
- data/spec/beaker/dsl/install_utils_spec.rb +0 -1242
@@ -84,4 +84,112 @@ describe ClassMixedWithDSLStructure do
|
|
84
84
|
expect{ subject.expect_failure 'this has no failure', &block }.to raise_error(RuntimeError, /An assertion was expected to fail, but passed/)
|
85
85
|
end
|
86
86
|
end
|
87
|
+
|
88
|
+
describe 'confine' do
|
89
|
+
let(:logger) { double.as_null_object }
|
90
|
+
before do
|
91
|
+
allow( subject ).to receive( :logger ).and_return( logger )
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'skips the test if there are no applicable hosts' do
|
95
|
+
allow( subject ).to receive( :hosts ).and_return( [] )
|
96
|
+
allow( subject ).to receive( :hosts= )
|
97
|
+
expect( logger ).to receive( :warn )
|
98
|
+
expect( subject ).to receive( :skip_test ).
|
99
|
+
with( 'No suitable hosts found' )
|
100
|
+
|
101
|
+
subject.confine( :to, {} )
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'raises when given mode is not :to or :except' do
|
105
|
+
allow( subject ).to receive( :hosts )
|
106
|
+
allow( subject ).to receive( :hosts= )
|
107
|
+
|
108
|
+
expect {
|
109
|
+
subject.confine( :regardless, {:thing => 'value'} )
|
110
|
+
}.to raise_error( 'Unknown option regardless' )
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'rejects hosts that do not meet simple hash criteria' do
|
114
|
+
hosts = [ {'thing' => 'foo'}, {'thing' => 'bar'} ]
|
115
|
+
|
116
|
+
expect( subject ).to receive( :hosts ).and_return( hosts )
|
117
|
+
expect( subject ).to receive( :hosts= ).
|
118
|
+
with( [ {'thing' => 'foo'} ] )
|
119
|
+
|
120
|
+
subject.confine :to, :thing => 'foo'
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'rejects hosts that match a list of criteria' do
|
124
|
+
hosts = [ {'thing' => 'foo'}, {'thing' => 'bar'}, {'thing' => 'baz'} ]
|
125
|
+
|
126
|
+
expect( subject ).to receive( :hosts ).and_return( hosts )
|
127
|
+
expect( subject ).to receive( :hosts= ).
|
128
|
+
with( [ {'thing' => 'bar'} ] )
|
129
|
+
|
130
|
+
subject.confine :except, :thing => ['foo', 'baz']
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'rejects hosts when a passed block returns true' do
|
134
|
+
host1 = {'platform' => 'solaris'}
|
135
|
+
host2 = {'platform' => 'solaris'}
|
136
|
+
host3 = {'platform' => 'windows'}
|
137
|
+
ret1 = (Struct.new('Result1', :stdout)).new(':global')
|
138
|
+
ret2 = (Struct.new('Result2', :stdout)).new('a_zone')
|
139
|
+
hosts = [ host1, host2, host3 ]
|
140
|
+
|
141
|
+
expect( subject ).to receive( :hosts ).and_return( hosts )
|
142
|
+
expect( subject ).to receive( :on ).
|
143
|
+
with( host1, '/sbin/zonename' ).
|
144
|
+
and_return( ret1 )
|
145
|
+
expect( subject ).to receive( :on ).
|
146
|
+
with( host1, '/sbin/zonename' ).
|
147
|
+
and_return( ret2 )
|
148
|
+
|
149
|
+
expect( subject ).to receive( :hosts= ).with( [ host1 ] )
|
150
|
+
|
151
|
+
subject.confine :to, :platform => 'solaris' do |host|
|
152
|
+
subject.on( host, '/sbin/zonename' ).stdout =~ /:global/
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe '#select_hosts' do
|
158
|
+
let(:logger) { double.as_null_object }
|
159
|
+
before do
|
160
|
+
allow( subject ).to receive( :logger ).and_return( logger )
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'it returns an empty array if there are no applicable hosts' do
|
164
|
+
hosts = [ {'thing' => 'foo'}, {'thing' => 'bar'} ]
|
165
|
+
|
166
|
+
expect(subject.select_hosts( {'thing' => 'nope'}, hosts )).to be == []
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'selects hosts that match a list of criteria' do
|
170
|
+
hosts = [ {'thing' => 'foo'}, {'thing' => 'bar'}, {'thing' => 'baz'} ]
|
171
|
+
|
172
|
+
expect(subject.select_hosts( {:thing => ['foo', 'baz']}, hosts )).to be == [ {'thing' => 'foo'}, {'thing' => 'baz'} ]
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'selects hosts when a passed block returns true' do
|
176
|
+
host1 = {'platform' => 'solaris1'}
|
177
|
+
host2 = {'platform' => 'solaris2'}
|
178
|
+
host3 = {'platform' => 'windows'}
|
179
|
+
ret1 = double('result1')
|
180
|
+
allow( ret1 ).to receive( :stdout ).and_return(':global')
|
181
|
+
ret2 = double('result2')
|
182
|
+
allow( ret2 ).to receive( :stdout ).and_return('a_zone')
|
183
|
+
hosts = [ host1, host2, host3 ]
|
184
|
+
expect( subject ).to receive( :hosts ).and_return( hosts )
|
185
|
+
|
186
|
+
expect( subject ).to receive( :on ).with( host1, '/sbin/zonename' ).once.and_return( ret1 )
|
187
|
+
expect( subject ).to receive( :on ).with( host2, '/sbin/zonename' ).once.and_return( ret2 )
|
188
|
+
|
189
|
+
selected_hosts = subject.select_hosts 'platform' => 'solaris' do |host|
|
190
|
+
subject.on(host, '/sbin/zonename').stdout =~ /:global/
|
191
|
+
end
|
192
|
+
expect( selected_hosts ).to be == [ host1 ]
|
193
|
+
end
|
194
|
+
end
|
87
195
|
end
|
@@ -21,6 +21,50 @@ describe Beaker do
|
|
21
21
|
hosts }
|
22
22
|
let( :dummy_class ) { Class.new { include Beaker::HostPrebuiltSteps } }
|
23
23
|
|
24
|
+
shared_examples 'enables_root_login' do |platform, commands, non_cygwin|
|
25
|
+
subject { dummy_class.new }
|
26
|
+
it "can enable root login on #{platform}" do
|
27
|
+
hosts = make_hosts( { :platform => platform, :is_cygwin => non_cygwin} )
|
28
|
+
|
29
|
+
if commands.empty?
|
30
|
+
expect( Beaker::Command ).to receive( :new ).exactly( 0 ).times
|
31
|
+
end
|
32
|
+
|
33
|
+
commands.each do | command |
|
34
|
+
expect( Beaker::Command ).to receive( :new ).with(command).exactly( 3 ).times
|
35
|
+
end
|
36
|
+
|
37
|
+
subject.enable_root_login( hosts, options )
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Non-cygwin Windows
|
42
|
+
it_should_behave_like 'enables_root_login', 'pswindows', [], false
|
43
|
+
|
44
|
+
# Non-cygwin Windows
|
45
|
+
it_should_behave_like 'enables_root_login', 'windows', [
|
46
|
+
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\""
|
47
|
+
], true
|
48
|
+
|
49
|
+
it_should_behave_like 'enables_root_login', 'osx', [
|
50
|
+
"sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /etc/sshd_config",
|
51
|
+
"sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /etc/sshd_config"
|
52
|
+
]
|
53
|
+
|
54
|
+
['debian','ubuntu','cumulus'].each do | deb_like |
|
55
|
+
it_should_behave_like 'enables_root_login', deb_like, [
|
56
|
+
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
|
57
|
+
"sudo su -c \"service ssh restart\""
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
['centos','el-','redhat','fedora','eos'].each do | rhel_like |
|
62
|
+
it_should_behave_like 'enables_root_login', rhel_like, [
|
63
|
+
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
|
64
|
+
"sudo -E /sbin/service sshd reload"
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
24
68
|
context 'timesync' do
|
25
69
|
|
26
70
|
subject { dummy_class.new }
|
data/spec/beaker/host_spec.rb
CHANGED
@@ -594,5 +594,46 @@ module Beaker
|
|
594
594
|
end
|
595
595
|
|
596
596
|
end
|
597
|
+
|
598
|
+
context 'deprecating host keys' do
|
599
|
+
|
600
|
+
describe '#build_deprecated_keys' do
|
601
|
+
|
602
|
+
it 'returns the correct array for a unix host' do
|
603
|
+
expect( host.build_deprecated_keys().include?(:puppetvardir) ).to be_truthy
|
604
|
+
end
|
605
|
+
|
606
|
+
it 'returns the correct array for a windows host' do
|
607
|
+
@platform = 'windows-xp-me-bla'
|
608
|
+
expect( host.build_deprecated_keys().include?(:hieraconf) ).to be_truthy
|
609
|
+
end
|
610
|
+
|
611
|
+
it 'can be called on an unsupported host type without an error being thrown' do
|
612
|
+
@platform = 'mac-osx-foo-tigerlion'
|
613
|
+
expect{ host.build_deprecated_keys() }.not_to raise_error
|
614
|
+
end
|
615
|
+
|
616
|
+
it 'returns an empty array for unsupported host types' do
|
617
|
+
@platform = 'mac-osx-foo-tigerlion'
|
618
|
+
expect( host.build_deprecated_keys().empty? ).to be_truthy
|
619
|
+
end
|
620
|
+
|
621
|
+
end
|
622
|
+
|
623
|
+
describe '#[]' do
|
624
|
+
|
625
|
+
it 'does not log for a key that isn\'t deprecated' do
|
626
|
+
expect( host ).to receive( :@logger ).exactly(0).times
|
627
|
+
host['puppetbindir']
|
628
|
+
end
|
629
|
+
|
630
|
+
it 'logs the warning message for a deprecated key' do
|
631
|
+
expect( host.instance_variable_get(:@logger) ).to receive( :warn ).once
|
632
|
+
host['hierapuppetlibdir']
|
633
|
+
end
|
634
|
+
|
635
|
+
end
|
636
|
+
|
637
|
+
end
|
597
638
|
end
|
598
639
|
end
|
@@ -34,6 +34,7 @@ module Beaker
|
|
34
34
|
vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
|
35
35
|
expect( vagrantfile ).to be === <<-EOF
|
36
36
|
Vagrant.configure("2") do |c|
|
37
|
+
c.ssh.insert_key = false
|
37
38
|
c.vm.define 'vm1' do |v|
|
38
39
|
v.vm.hostname = 'vm1'
|
39
40
|
v.vm.box = 'vm1_of_my_box'
|
@@ -185,7 +186,7 @@ EOF
|
|
185
186
|
allow( file ).to receive( :path ).and_return( '/path/sshconfig' )
|
186
187
|
allow( file ).to receive( :rewind ).and_return( true )
|
187
188
|
|
188
|
-
expect( Tempfile ).to receive( :new ).with( "#{host.name}").and_return( file )
|
189
|
+
expect( Tempfile ).to receive( :new ).with( "#{host.name}").and_return( file )
|
189
190
|
expect( file ).to receive( :write ).with("Host ip.address.for.#{name}\n HostName 127.0.0.1\n User root\n Port 2222\n UserKnownHostsFile /dev/null\n StrictHostKeyChecking no\n PasswordAuthentication no\n IdentityFile /home/root/.vagrant.d/insecure_private_key\n IdentitiesOnly yes")
|
190
191
|
|
191
192
|
vagrant.set_ssh_config( host, 'root' )
|
data/spec/beaker/logger_spec.rb
CHANGED
@@ -6,6 +6,7 @@ module Beaker
|
|
6
6
|
let(:my_io) { MockIO.new }
|
7
7
|
let(:logger) { Logger.new(my_io, :quiet => true) }
|
8
8
|
let(:test_dir) { 'tmp/tests' }
|
9
|
+
let(:dummy_prefix) { 'dummy' }
|
9
10
|
|
10
11
|
context '#convert' do
|
11
12
|
let(:valid_utf8) { "/etc/puppet/modules\n├── jimmy-appleseed (\e[0;36mv1.1.0\e[0m)\n├── jimmy-crakorn (\e[0;36mv0.4.0\e[0m)\n└── jimmy-thelock (\e[0;36mv1.0.0\e[0m)\n" }
|
@@ -28,12 +29,18 @@ module Beaker
|
|
28
29
|
|
29
30
|
it 'generates path for a given timestamp' do
|
30
31
|
input_time = Time.new(2014, 6, 2, 16, 31, 22, '-07:00')
|
31
|
-
expect( Logger.generate_dated_log_folder(test_dir, input_time) ).to be === File.join(test_dir, '2014-06-02_16_31_22')
|
32
|
+
expect( Logger.generate_dated_log_folder(test_dir, dummy_prefix, input_time) ).to be === File.join(test_dir, dummy_prefix, '2014-06-02_16_31_22')
|
32
33
|
end
|
33
34
|
|
34
35
|
it 'generates directory for a given timestamp' do
|
35
36
|
input_time = Time.new(2011, 6, 10, 13, 7, 55, '-09:00')
|
36
|
-
expect( File.directory? Logger.generate_dated_log_folder(test_dir, input_time) ).to be_truthy
|
37
|
+
expect( File.directory? Logger.generate_dated_log_folder(test_dir, dummy_prefix, input_time) ).to be_truthy
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'generates nested directories if given as a log_prefix' do
|
41
|
+
input_time = Time.new(2011, 6, 10, 13, 7, 55, '-09:00')
|
42
|
+
prefix = 'a/man/a/plan/a/canal/panama'
|
43
|
+
expect( File.directory? Logger.generate_dated_log_folder(test_dir, prefix, input_time) ).to be_truthy
|
37
44
|
end
|
38
45
|
|
39
46
|
end
|
@@ -7,7 +7,13 @@ module Beaker
|
|
7
7
|
mock_provisioning_logger = Object.new
|
8
8
|
allow( mock_provisioning_logger ).to receive( :notify )
|
9
9
|
mock_provisioning_logger }
|
10
|
-
let( :options ) {
|
10
|
+
let( :options ) {
|
11
|
+
make_opts.merge({
|
12
|
+
'logger' => double().as_null_object,
|
13
|
+
:logger_sut => mock_provisioning_logger,
|
14
|
+
:log_prefix => 'log_prefix_dummy'
|
15
|
+
})
|
16
|
+
}
|
11
17
|
let( :network_manager ) { NetworkManager.new(options, options[:logger]) }
|
12
18
|
let( :hosts ) { make_hosts }
|
13
19
|
let( :host ) { hosts[0] }
|
@@ -6,7 +6,8 @@ module Beaker
|
|
6
6
|
|
7
7
|
let(:parser) {Beaker::Options::CommandLineParser.new}
|
8
8
|
let(:test_opts) {["-h", "vcloud.cfg", "--debug", "--tests", "test.rb", "--help"]}
|
9
|
-
let(:
|
9
|
+
let(:full_opts_in) {["--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", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info", "--package-proxy", "http://192.168.100.1:3128", "--collect-perf-data", "--parse-only", "--validate", "--timeout", "40", "--log-prefix", "pants"]}
|
10
|
+
let(:full_opts_out) {{: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, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode => "fast", :color=>false, :version=>true, :log_level => "info", :package_proxy => "http://192.168.100.1:3128", :collect_perf_data=>true, :parse_only=>true, :validate=>true, :timeout => "40", :log_prefix => "pants"}}
|
10
11
|
let(:validate_true) {["--validate"]}
|
11
12
|
let(:validate_false) {["--no-validate"]}
|
12
13
|
let(:configure_true) {['--configure']}
|
@@ -18,7 +19,7 @@ module Beaker
|
|
18
19
|
end
|
19
20
|
|
20
21
|
it "supports all our command line options" do
|
21
|
-
expect(parser.parse(
|
22
|
+
expect(parser.parse(full_opts_in)).to be === full_opts_out
|
22
23
|
end
|
23
24
|
|
24
25
|
it "supports both validate options" do
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Beaker
|
4
|
+
module Shared
|
5
|
+
describe Semvar do
|
6
|
+
|
7
|
+
describe 'version_is_less' do
|
8
|
+
|
9
|
+
it 'reports 3.0.0-160-gac44cfb is not less than 3.0.0' do
|
10
|
+
expect( subject.version_is_less( '3.0.0-160-gac44cfb', '3.0.0' ) ).to be === false
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'reports 3.0.0-160-gac44cfb is not less than 2.8.2' do
|
14
|
+
expect( subject.version_is_less( '3.0.0-160-gac44cfb', '2.8.2' ) ).to be === false
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'reports 3.0.0 is less than 3.0.0-160-gac44cfb' do
|
18
|
+
expect( subject.version_is_less( '3.0.0', '3.0.0-160-gac44cfb' ) ).to be === true
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'reports 2.8.2 is less than 3.0.0-160-gac44cfb' do
|
22
|
+
expect( subject.version_is_less( '2.8.2', '3.0.0-160-gac44cfb' ) ).to be === true
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'reports 2.8 is less than 3.0.0-160-gac44cfb' do
|
26
|
+
expect( subject.version_is_less( '2.8', '3.0.0-160-gac44cfb' ) ).to be === true
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'reports 2.8 is less than 2.9' do
|
30
|
+
expect( subject.version_is_less( '2.8', '2.9' ) ).to be === true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -207,5 +207,53 @@ module Beaker
|
|
207
207
|
|
208
208
|
|
209
209
|
end
|
210
|
+
|
211
|
+
describe '#log_path' do
|
212
|
+
let( :sh_test ) { '/my_shell_file.sh' }
|
213
|
+
let( :files ) { @files ? @files : [sh_test] }
|
214
|
+
let( :options ) { make_opts.merge({ :logger => double().as_null_object, 'name' => create_files(files) }) }
|
215
|
+
let( :hosts ) { make_hosts() }
|
216
|
+
let( :testsuite ) { Beaker::TestSuite.new( 'name', hosts, options, Time.now, :stop ) }
|
217
|
+
|
218
|
+
it 'returns the simple joining of the log dir & file as required' do
|
219
|
+
expect(testsuite.log_path('foo.txt', 'man/date')).to be === 'man/date/foo.txt'
|
220
|
+
end
|
221
|
+
|
222
|
+
describe 'builds the base directory correctly' do
|
223
|
+
# the base directory is where the latest symlink itself should live
|
224
|
+
|
225
|
+
it 'in the usual case' do
|
226
|
+
expect( File.symlink?('man/latest') ).to be_falsy
|
227
|
+
testsuite.log_path('foo.txt', 'man/date')
|
228
|
+
expect( File.symlink?('man/latest') ).to be_truthy
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'if given a nested directory' do
|
232
|
+
expect( File.symlink?('a/latest') ).to be_falsy
|
233
|
+
testsuite.log_path('foo.txt', 'a/b/c/d/e/f')
|
234
|
+
expect( File.symlink?('a/latest') ).to be_truthy
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
describe 'builds the symlink directory correctly' do
|
240
|
+
# the symlink directory is where the symlink points to
|
241
|
+
|
242
|
+
it 'in the usual case' do
|
243
|
+
expect( File.symlink?('d/latest') ).to be_falsy
|
244
|
+
testsuite.log_path('foo.txt', 'd/e')
|
245
|
+
expect( File.readlink('d/latest') ).to be === 'e'
|
246
|
+
end
|
247
|
+
|
248
|
+
it 'if given a nested directory' do
|
249
|
+
expect( File.symlink?('f/latest') ).to be_falsy
|
250
|
+
testsuite.log_path('foo.txt', 'f/g/h/i/j/k')
|
251
|
+
expect( File.readlink('f/latest') ).to be === 'g/h/i/j/k'
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|
257
|
+
|
210
258
|
end
|
211
259
|
end
|
data/spec/mocks.rb
CHANGED
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: 2.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -412,9 +412,18 @@ files:
|
|
412
412
|
- lib/beaker/command_factory.rb
|
413
413
|
- lib/beaker/dsl.rb
|
414
414
|
- lib/beaker/dsl/assertions.rb
|
415
|
-
- lib/beaker/dsl/ezbake_utils.rb
|
416
415
|
- lib/beaker/dsl/helpers.rb
|
416
|
+
- lib/beaker/dsl/helpers/facter_helpers.rb
|
417
|
+
- lib/beaker/dsl/helpers/hiera_helpers.rb
|
418
|
+
- lib/beaker/dsl/helpers/host_helpers.rb
|
419
|
+
- lib/beaker/dsl/helpers/puppet_helpers.rb
|
420
|
+
- lib/beaker/dsl/helpers/tk_helpers.rb
|
421
|
+
- lib/beaker/dsl/helpers/web_helpers.rb
|
417
422
|
- lib/beaker/dsl/install_utils.rb
|
423
|
+
- lib/beaker/dsl/install_utils/ezbake_utils.rb
|
424
|
+
- lib/beaker/dsl/install_utils/module_utils.rb
|
425
|
+
- lib/beaker/dsl/install_utils/pe_utils.rb
|
426
|
+
- lib/beaker/dsl/install_utils/puppet_utils.rb
|
418
427
|
- lib/beaker/dsl/outcomes.rb
|
419
428
|
- lib/beaker/dsl/patterns.rb
|
420
429
|
- lib/beaker/dsl/roles.rb
|
@@ -487,6 +496,7 @@ files:
|
|
487
496
|
- lib/beaker/shared/error_handler.rb
|
488
497
|
- lib/beaker/shared/host_manager.rb
|
489
498
|
- lib/beaker/shared/repetition.rb
|
499
|
+
- lib/beaker/shared/semvar.rb
|
490
500
|
- lib/beaker/shared/timed.rb
|
491
501
|
- lib/beaker/ssh_connection.rb
|
492
502
|
- lib/beaker/tasks/rake_task.rb
|
@@ -499,8 +509,15 @@ files:
|
|
499
509
|
- spec/beaker/command_spec.rb
|
500
510
|
- spec/beaker/dsl/assertions_spec.rb
|
501
511
|
- spec/beaker/dsl/ezbake_utils_spec.rb
|
502
|
-
- spec/beaker/dsl/
|
503
|
-
- spec/beaker/dsl/
|
512
|
+
- spec/beaker/dsl/helpers/facter_helpers_spec.rb
|
513
|
+
- spec/beaker/dsl/helpers/hiera_helpers_spec.rb
|
514
|
+
- spec/beaker/dsl/helpers/host_helpers_spec.rb
|
515
|
+
- spec/beaker/dsl/helpers/puppet_helpers_spec.rb
|
516
|
+
- spec/beaker/dsl/helpers/tk_helpers_spec.rb
|
517
|
+
- spec/beaker/dsl/helpers/web_helpers_spec.rb
|
518
|
+
- spec/beaker/dsl/install_utils/module_utils_spec.rb
|
519
|
+
- spec/beaker/dsl/install_utils/pe_utils_spec.rb
|
520
|
+
- spec/beaker/dsl/install_utils/puppet_utils_spec.rb
|
504
521
|
- spec/beaker/dsl/outcomes_spec.rb
|
505
522
|
- spec/beaker/dsl/roles_spec.rb
|
506
523
|
- spec/beaker/dsl/structure_spec.rb
|
@@ -547,6 +564,7 @@ files:
|
|
547
564
|
- spec/beaker/shared/error_handler_spec.rb
|
548
565
|
- spec/beaker/shared/host_manager_spec.rb
|
549
566
|
- spec/beaker/shared/repetition_spec.rb
|
567
|
+
- spec/beaker/shared/semvar_spec.rb
|
550
568
|
- spec/beaker/ssh_connection_spec.rb
|
551
569
|
- spec/beaker/test_case_spec.rb
|
552
570
|
- spec/beaker/test_suite_spec.rb
|