beaker 2.24.0 → 2.25.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/CONTRIBUTING.md +2 -7
- data/HISTORY.md +238 -2
- data/acceptance/tests/base/dsl/structure_test.rb +16 -0
- data/beaker.gemspec +4 -0
- data/lib/beaker/dsl/helpers.rb +3 -2
- data/lib/beaker/dsl/install_utils/foss_utils.rb +55 -6
- data/lib/beaker/dsl/structure.rb +28 -7
- data/lib/beaker/host.rb +2 -0
- data/lib/beaker/host_prebuilt_steps.rb +21 -9
- data/lib/beaker/hypervisor/aws_sdk.rb +86 -10
- data/lib/beaker/logger.rb +49 -1
- data/lib/beaker/options/presets.rb +1 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +49 -28
- data/spec/beaker/dsl/structure_spec.rb +44 -7
- data/spec/beaker/host_prebuilt_steps_spec.rb +7 -1
- data/spec/beaker/host_spec.rb +2 -0
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +149 -9
- data/spec/beaker/logger_spec.rb +70 -0
- metadata +30 -4
- data/lib/beaker/dsl/helpers/hiera_helpers.rb +0 -60
- data/spec/beaker/dsl/helpers/hiera_helpers_spec.rb +0 -96
@@ -28,8 +28,10 @@ describe ClassMixedWithDSLStructure do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'yields if a block is given' do
|
31
|
-
expect( subject ).to receive( :logger ).and_return( logger )
|
31
|
+
expect( subject ).to receive( :logger ).and_return( logger ).exactly(3).times
|
32
32
|
allow( subject ).to receive( :set_current_step_name )
|
33
|
+
expect( logger ).to receive( :step_in )
|
34
|
+
expect( logger ).to receive( :step_out )
|
33
35
|
expect( logger ).to receive( :notify )
|
34
36
|
expect( subject ).to receive( :foo )
|
35
37
|
subject.step 'blah' do
|
@@ -59,8 +61,10 @@ describe ClassMixedWithDSLStructure do
|
|
59
61
|
end
|
60
62
|
|
61
63
|
it 'yields if a block is given' do
|
62
|
-
expect( subject ).to receive( :logger ).and_return( logger )
|
64
|
+
expect( subject ).to receive( :logger ).and_return( logger ).exactly(3).times
|
63
65
|
expect( logger ).to receive( :notify )
|
66
|
+
expect( logger ).to receive( :step_in )
|
67
|
+
expect( logger ).to receive( :step_out )
|
64
68
|
expect( subject ).to receive( :foo )
|
65
69
|
subject.test_name 'blah' do
|
66
70
|
subject.foo
|
@@ -131,6 +135,7 @@ describe ClassMixedWithDSLStructure do
|
|
131
135
|
it ':to - uses a provided host subset when no criteria is provided' do
|
132
136
|
subset = ['host1', 'host2']
|
133
137
|
hosts = subset.dup << 'host3'
|
138
|
+
allow( subject ).to receive( :hosts ).and_return(hosts).twice
|
134
139
|
expect( subject ).to receive( :hosts= ).with( subset )
|
135
140
|
subject.confine :to, {}, subset
|
136
141
|
end
|
@@ -138,13 +143,14 @@ describe ClassMixedWithDSLStructure do
|
|
138
143
|
it ':except - excludes provided host subset when no criteria is provided' do
|
139
144
|
subset = ['host1', 'host2']
|
140
145
|
hosts = subset.dup << 'host3'
|
141
|
-
allow( subject ).to receive( :hosts ).and_return(hosts)
|
146
|
+
allow( subject ).to receive( :hosts ).and_return(hosts).twice
|
142
147
|
expect( subject ).to receive( :hosts= ).with( hosts - subset )
|
143
148
|
subject.confine :except, {}, subset
|
144
149
|
end
|
145
150
|
|
146
151
|
it 'raises when given mode is not :to or :except' do
|
147
|
-
|
152
|
+
hosts = ['host1', 'host2']
|
153
|
+
allow( subject ).to receive( :hosts ).and_return(hosts)
|
148
154
|
allow( subject ).to receive( :hosts= )
|
149
155
|
|
150
156
|
expect {
|
@@ -155,7 +161,7 @@ describe ClassMixedWithDSLStructure do
|
|
155
161
|
it 'rejects hosts that do not meet simple hash criteria' do
|
156
162
|
hosts = [ {'thing' => 'foo'}, {'thing' => 'bar'} ]
|
157
163
|
|
158
|
-
expect( subject ).to receive( :hosts ).and_return( hosts )
|
164
|
+
expect( subject ).to receive( :hosts ).and_return( hosts ).twice
|
159
165
|
expect( subject ).to receive( :hosts= ).
|
160
166
|
with( [ {'thing' => 'foo'} ] )
|
161
167
|
|
@@ -165,7 +171,7 @@ describe ClassMixedWithDSLStructure do
|
|
165
171
|
it 'rejects hosts that match a list of criteria' do
|
166
172
|
hosts = [ {'thing' => 'foo'}, {'thing' => 'bar'}, {'thing' => 'baz'} ]
|
167
173
|
|
168
|
-
expect( subject ).to receive( :hosts ).and_return( hosts )
|
174
|
+
expect( subject ).to receive( :hosts ).and_return( hosts ).twice
|
169
175
|
expect( subject ).to receive( :hosts= ).
|
170
176
|
with( [ {'thing' => 'bar'} ] )
|
171
177
|
|
@@ -180,7 +186,7 @@ describe ClassMixedWithDSLStructure do
|
|
180
186
|
ret2 = (Struct.new('Result2', :stdout)).new('a_zone')
|
181
187
|
hosts = [ host1, host2, host3 ]
|
182
188
|
|
183
|
-
expect( subject ).to receive( :hosts ).and_return( hosts )
|
189
|
+
expect( subject ).to receive( :hosts ).and_return( hosts ).twice
|
184
190
|
expect( subject ).to receive( :on ).
|
185
191
|
with( host1, '/sbin/zonename' ).
|
186
192
|
and_return( ret1 )
|
@@ -194,6 +200,37 @@ describe ClassMixedWithDSLStructure do
|
|
194
200
|
subject.on( host, '/sbin/zonename' ).stdout =~ /:global/
|
195
201
|
end
|
196
202
|
end
|
203
|
+
|
204
|
+
it 'doesn\'t corrupt the global hosts hash when confining from a subset of hosts' do
|
205
|
+
host1 = {'platform' => 'solaris', :roles => ['master']}
|
206
|
+
host2 = {'platform' => 'solaris', :roles => ['agent']}
|
207
|
+
host3 = {'platform' => 'windows', :roles => ['agent']}
|
208
|
+
hosts = [ host1, host2, host3 ]
|
209
|
+
agents = [ host2, host3 ]
|
210
|
+
|
211
|
+
expect( subject ).to receive( :hosts ).and_return( hosts )
|
212
|
+
expect( subject ).to receive( :hosts= ).with( [ host2, host1 ] )
|
213
|
+
confined_hosts = subject.confine :except, {:platform => 'windows'}, agents
|
214
|
+
expect( confined_hosts ).to be === [ host2, host1 ]
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'can apply multiple confines correctly' do
|
218
|
+
host1 = {'platform' => 'solaris', :roles => ['master']}
|
219
|
+
host2 = {'platform' => 'solaris', :roles => ['agent']}
|
220
|
+
host3 = {'platform' => 'windows', :roles => ['agent']}
|
221
|
+
host4 = {'platform' => 'fedora', :roles => ['agent']}
|
222
|
+
host5 = {'platform' => 'fedora', :roles => ['agent']}
|
223
|
+
hosts = [ host1, host2, host3, host4, host5 ]
|
224
|
+
agents = [ host2, host3, host4, host5 ]
|
225
|
+
|
226
|
+
expect( subject ).to receive( :hosts ).and_return( hosts ).exactly(3).times
|
227
|
+
expect( subject ).to receive( :hosts= ).with( [ host1, host2, host4, host5 ] )
|
228
|
+
hosts = subject.confine :except, {:platform => 'windows'}
|
229
|
+
expect( hosts ).to be === [ host1, host2, host4, host5 ]
|
230
|
+
expect( subject ).to receive( :hosts= ).with( [ host4, host5, host1 ] )
|
231
|
+
hosts = subject.confine :to, {:platform => 'fedora'}, agents
|
232
|
+
expect( hosts ).to be === [ host4, host5, host1 ]
|
233
|
+
end
|
197
234
|
end
|
198
235
|
|
199
236
|
describe '#select_hosts' do
|
@@ -154,6 +154,12 @@ describe Beaker do
|
|
154
154
|
context "epel_info_for!" do
|
155
155
|
subject { dummy_class.new }
|
156
156
|
|
157
|
+
it "can return the correct url for an el-7 host" do
|
158
|
+
host = make_host( 'testhost', { :platform => Beaker::Platform.new('el-7-platform') } )
|
159
|
+
|
160
|
+
expect( subject.epel_info_for( host, options )).to be === ["http://mirrors.kernel.org/fedora-epel/7", "x86_64", "epel-release-7-5.noarch.rpm"]
|
161
|
+
end
|
162
|
+
|
157
163
|
it "can return the correct url for an el-6 host" do
|
158
164
|
host = make_host( 'testhost', { :platform => Beaker::Platform.new('el-6-platform') } )
|
159
165
|
|
@@ -170,7 +176,7 @@ describe Beaker do
|
|
170
176
|
it "raises an error on non el-5/6 host" do
|
171
177
|
host = make_host( 'testhost', { :platform => Beaker::Platform.new('el-4-platform') } )
|
172
178
|
|
173
|
-
expect{ subject.epel_info_for( host, options )}.to raise_error(
|
179
|
+
expect{ subject.epel_info_for( host, options )}.to raise_error(ArgumentError, /epel_info_for does not support el version/)
|
174
180
|
|
175
181
|
end
|
176
182
|
|
data/spec/beaker/host_spec.rb
CHANGED
@@ -240,6 +240,8 @@ module Beaker
|
|
240
240
|
logger = double(:logger)
|
241
241
|
allow( logger ).to receive(:host_output)
|
242
242
|
allow( logger ).to receive(:debug)
|
243
|
+
allow( logger ).to receive(:step_in)
|
244
|
+
allow( logger ).to receive(:step_out)
|
243
245
|
host.instance_variable_set :@logger, logger
|
244
246
|
conn = double(:connection)
|
245
247
|
allow( conn ).to receive(:execute).and_return(result)
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Beaker
|
4
4
|
describe AwsSdk do
|
5
|
-
let( :options ) { make_opts.merge({ 'logger' => double().as_null_object }) }
|
5
|
+
let( :options ) { make_opts.merge({ 'logger' => double().as_null_object, 'timestamp' => Time.now }) }
|
6
6
|
let(:aws) {
|
7
7
|
# Mock out the call to load_fog_credentials
|
8
8
|
allow_any_instance_of( Beaker::AwsSdk ).
|
@@ -211,6 +211,7 @@ module Beaker
|
|
211
211
|
context 'with a list of hosts' do
|
212
212
|
before :each do
|
213
213
|
@hosts.each {|host| host['instance'] = ec2_instance}
|
214
|
+
expect(aws).to receive( :delete_key_pair_all_regions )
|
214
215
|
end
|
215
216
|
|
216
217
|
it { is_expected.to be_nil }
|
@@ -224,6 +225,7 @@ module Beaker
|
|
224
225
|
context 'with an empty host list' do
|
225
226
|
before :each do
|
226
227
|
@hosts = []
|
228
|
+
expect(aws).to receive( :delete_key_pair_all_regions )
|
227
229
|
end
|
228
230
|
|
229
231
|
it { is_expected.to be_nil }
|
@@ -268,7 +270,16 @@ module Beaker
|
|
268
270
|
it { is_expected.to be_instance_of(AWS::EC2::SecurityGroupCollection) }
|
269
271
|
end
|
270
272
|
|
271
|
-
describe '#kill_zombies'
|
273
|
+
describe '#kill_zombies' do
|
274
|
+
it 'calls delete_key_pair_all_regions' do
|
275
|
+
ec2_mock = Object.new
|
276
|
+
allow(ec2_mock).to receive( :regions ).and_return( {} )
|
277
|
+
aws.instance_variable_set( :@ec2, ec2_mock )
|
278
|
+
|
279
|
+
expect( aws ).to receive( :delete_key_pair_all_regions ).once
|
280
|
+
|
281
|
+
aws.kill_zombies()
|
282
|
+
end
|
272
283
|
end
|
273
284
|
|
274
285
|
describe '#kill_zombie_volumes', :wip do
|
@@ -634,8 +645,11 @@ module Beaker
|
|
634
645
|
expect( Socket ).to receive(:gethostname) { "foobar" }
|
635
646
|
expect( aws ).to receive(:local_user) { "bob" }
|
636
647
|
|
648
|
+
options[:timestamp] = Time.now
|
649
|
+
date_part = options[:timestamp].strftime("%F_%H_%M_%S")
|
650
|
+
|
637
651
|
# Should match the expected composite key name
|
638
|
-
expect(aws.key_name).to eq("Beaker-bob-foobar")
|
652
|
+
expect(aws.key_name).to eq("Beaker-bob-foobar-#{date_part}")
|
639
653
|
end
|
640
654
|
end
|
641
655
|
|
@@ -647,19 +661,37 @@ module Beaker
|
|
647
661
|
end
|
648
662
|
|
649
663
|
describe '#ensure_key_pair' do
|
650
|
-
let( :region ) { double('region') }
|
664
|
+
let( :region ) { double('region', :name => 'test_region_name') }
|
651
665
|
subject(:ensure_key_pair) { aws.ensure_key_pair(region) }
|
652
666
|
|
653
667
|
context 'when a beaker keypair already exists' do
|
654
668
|
it 'returns the keypair if available' do
|
655
669
|
stub_const('ENV', ENV.to_hash.merge('USER' => 'rspec'))
|
656
|
-
key_pair = double(:exists? => true, :secret => 'supersekritkey')
|
670
|
+
key_pair = double(:exists? => true, :secret => 'supersekritkey', :delete => true)
|
671
|
+
allow( aws ).to receive( :key_name ).and_return( "Beaker-rspec-SUT" )
|
657
672
|
key_pairs = { "Beaker-rspec-SUT" => key_pair }
|
658
673
|
|
659
|
-
expect( region ).to receive(:key_pairs).and_return(key_pairs).
|
660
|
-
expect(
|
674
|
+
expect( region ).to receive(:key_pairs).and_return(key_pairs).twice
|
675
|
+
expect( aws ).to receive( :public_key ).and_return('test_ssh_string')
|
676
|
+
expect( key_pairs ).to receive( :import ).and_return(key_pair)
|
661
677
|
expect(ensure_key_pair).to eq(key_pair)
|
662
678
|
end
|
679
|
+
|
680
|
+
it 'generates a new keypair if :generate_new_keypair set' do
|
681
|
+
stub_const('ENV', ENV.to_hash.merge('USER' => 'rspec'))
|
682
|
+
key_pair = double(:exists? => true, :secret => 'keyOfSekritz', :delete => true)
|
683
|
+
allow( aws ).to receive( :key_name ).and_return( "Beaker-rspec-SUT" )
|
684
|
+
key_pairs = { "Beaker-rspec-SUT" => key_pair }
|
685
|
+
options[:keypair_generate_new] = true
|
686
|
+
|
687
|
+
answer = 'You get a keypair! You get a keypair! And you get a keypair too!'
|
688
|
+
expect( region ).to receive(:key_pairs).and_return(key_pairs).twice
|
689
|
+
expect( aws ).to receive( :public_key ).and_return('test_ssh_string')
|
690
|
+
expect( key_pairs ).to receive( :import ).and_return(answer)
|
691
|
+
returned_keypair = ensure_key_pair
|
692
|
+
expect(returned_keypair).not_to eq(key_pair)
|
693
|
+
expect(returned_keypair).to eq(answer)
|
694
|
+
end
|
663
695
|
end
|
664
696
|
|
665
697
|
context 'when a pre-existing keypair cannot be found' do
|
@@ -670,8 +702,8 @@ module Beaker
|
|
670
702
|
|
671
703
|
before :each do
|
672
704
|
stub_const('ENV', ENV.to_hash.merge('USER' => 'rspec'))
|
673
|
-
expect( region ).to receive(:key_pairs).and_return(key_pairs).
|
674
|
-
|
705
|
+
expect( region ).to receive(:key_pairs).and_return(key_pairs).twice
|
706
|
+
allow( aws ).to receive( :key_name ).and_return(key_name)
|
675
707
|
end
|
676
708
|
|
677
709
|
it 'imports a new key based on user pubkey' do
|
@@ -688,6 +720,114 @@ module Beaker
|
|
688
720
|
end
|
689
721
|
end
|
690
722
|
|
723
|
+
describe '#delete_key_pair_all_regions' do
|
724
|
+
it 'calls delete_key_pair over all regions' do
|
725
|
+
key_name = 'kname_test1538'
|
726
|
+
allow(aws).to receive( :key_name ).and_return(key_name)
|
727
|
+
regions = []
|
728
|
+
regions << double('region', :key_pairs => 'pair1', :name => 'name1')
|
729
|
+
regions << double('region', :key_pairs => 'pair2', :name => 'name2')
|
730
|
+
ec2_mock = Object.new
|
731
|
+
allow(ec2_mock).to receive( :regions ).and_return(regions)
|
732
|
+
aws.instance_variable_set( :@ec2, ec2_mock )
|
733
|
+
region_keypairs_hash_mock = {}
|
734
|
+
region_keypairs_hash_mock[double('region')] = ['key1', 'key2', 'key3']
|
735
|
+
region_keypairs_hash_mock[double('region')] = ['key4', 'key5', 'key6']
|
736
|
+
allow( aws ).to receive( :my_key_pairs ).and_return( region_keypairs_hash_mock )
|
737
|
+
|
738
|
+
region_keypairs_hash_mock.each_pair do |region, keyname_array|
|
739
|
+
keyname_array.each do |keyname|
|
740
|
+
expect( aws ).to receive( :delete_key_pair ).with( region, keyname )
|
741
|
+
end
|
742
|
+
end
|
743
|
+
aws.delete_key_pair_all_regions
|
744
|
+
end
|
745
|
+
end
|
746
|
+
|
747
|
+
describe '#my_key_pairs' do
|
748
|
+
let( :region ) { double('region', :name => 'test_region_name') }
|
749
|
+
|
750
|
+
it 'uses the default keyname if no filter is given' do
|
751
|
+
default_keyname_answer = 'test_pair_6193'
|
752
|
+
allow( aws ).to receive( :key_name ).and_return( default_keyname_answer )
|
753
|
+
|
754
|
+
kp_mock_1 = double('keypair')
|
755
|
+
kp_mock_2 = double('keypair')
|
756
|
+
regions = []
|
757
|
+
regions << double('region', :key_pairs => kp_mock_1, :name => 'name1')
|
758
|
+
regions << double('region', :key_pairs => kp_mock_2, :name => 'name2')
|
759
|
+
ec2_mock = Object.new
|
760
|
+
allow( ec2_mock ).to receive( :regions ).and_return( regions )
|
761
|
+
aws.instance_variable_set( :@ec2, ec2_mock )
|
762
|
+
|
763
|
+
kp_mock = double('keypair')
|
764
|
+
allow( region ).to receive( :key_pairs ).and_return( kp_mock )
|
765
|
+
expect( kp_mock_1 ).to receive( :filter ).with( 'key-name', default_keyname_answer ).and_return( [] )
|
766
|
+
expect( kp_mock_2 ).to receive( :filter ).with( 'key-name', default_keyname_answer ).and_return( [] )
|
767
|
+
|
768
|
+
aws.my_key_pairs()
|
769
|
+
end
|
770
|
+
|
771
|
+
it 'uses the filter passed if given' do
|
772
|
+
default_keyname_answer = 'test_pair_6194'
|
773
|
+
allow( aws ).to receive( :key_name ).and_return( default_keyname_answer )
|
774
|
+
name_filter = 'filter_pair_1597'
|
775
|
+
filter_star = "#{name_filter}-*"
|
776
|
+
|
777
|
+
kp_mock_1 = double('keypair')
|
778
|
+
kp_mock_2 = double('keypair')
|
779
|
+
regions = []
|
780
|
+
regions << double('region', :key_pairs => kp_mock_1, :name => 'name1')
|
781
|
+
regions << double('region', :key_pairs => kp_mock_2, :name => 'name2')
|
782
|
+
ec2_mock = Object.new
|
783
|
+
allow( ec2_mock ).to receive( :regions ).and_return( regions )
|
784
|
+
aws.instance_variable_set( :@ec2, ec2_mock )
|
785
|
+
|
786
|
+
kp_mock = double('keypair')
|
787
|
+
allow( region ).to receive( :key_pairs ).and_return( kp_mock )
|
788
|
+
expect( kp_mock_1 ).to receive( :filter ).with( 'key-name', filter_star ).and_return( [] )
|
789
|
+
expect( kp_mock_2 ).to receive( :filter ).with( 'key-name', filter_star ).and_return( [] )
|
790
|
+
|
791
|
+
aws.my_key_pairs(name_filter)
|
792
|
+
end
|
793
|
+
end
|
794
|
+
|
795
|
+
describe '#delete_key_pair' do
|
796
|
+
let( :region ) { double('region', :name => 'test_region_name') }
|
797
|
+
|
798
|
+
it 'calls delete on a keypair if it exists' do
|
799
|
+
pair_name = 'pair1'
|
800
|
+
kp_mock = double('keypair', :exists? => true)
|
801
|
+
expect( kp_mock ).to receive( :delete ).once
|
802
|
+
pairs = { pair_name => kp_mock }
|
803
|
+
allow( region ).to receive( :key_pairs ).and_return( pairs )
|
804
|
+
aws.delete_key_pair(region, pair_name)
|
805
|
+
end
|
806
|
+
|
807
|
+
it 'skips delete on a keypair if it does not exist' do
|
808
|
+
pair_name = 'pair1'
|
809
|
+
kp_mock = double('keypair', :exists? => false)
|
810
|
+
expect( kp_mock ).to receive( :delete ).never
|
811
|
+
pairs = { pair_name => kp_mock }
|
812
|
+
allow( region ).to receive( :key_pairs ).and_return( pairs )
|
813
|
+
aws.delete_key_pair(region, pair_name)
|
814
|
+
end
|
815
|
+
end
|
816
|
+
|
817
|
+
describe '#create_new_key_pair' do
|
818
|
+
let( :region ) { double('region', :name => 'test_region_name') }
|
819
|
+
|
820
|
+
it 'imports the key given from public_key' do
|
821
|
+
ssh_string = 'ssh_string_test_0867'
|
822
|
+
allow( aws ).to receive( :public_key ).and_return( ssh_string )
|
823
|
+
pairs = double('keypairs')
|
824
|
+
pair_name = 'pair_name_1555432'
|
825
|
+
expect( pairs ).to receive( :import ).with( pair_name, ssh_string )
|
826
|
+
expect( region ).to receive(:key_pairs).and_return(pairs).once
|
827
|
+
aws.create_new_key_pair( region, pair_name )
|
828
|
+
end
|
829
|
+
end
|
830
|
+
|
691
831
|
describe '#group_id' do
|
692
832
|
it 'should return a predicatable group_id from a port list' do
|
693
833
|
expect(aws.group_id([22, 1024])).to eq("Beaker-2799478787")
|
data/spec/beaker/logger_spec.rb
CHANGED
@@ -45,6 +45,76 @@ module Beaker
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
+
context '#prefix_log_line' do
|
49
|
+
def prefix_log_line_test_compare_helper(in_test, out_answer, step_in_loop=1)
|
50
|
+
logger.instance_variable_set( :@line_prefix_length, 0 )
|
51
|
+
step_in_loop.times { logger.step_in() }
|
52
|
+
expect( logger.prefix_log_line(in_test) ).to be === out_answer
|
53
|
+
logger.instance_variable_set( :@line_prefix_length, 0 )
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'can be successfully called with a arrays' do
|
57
|
+
line_arg = ['who done that', 'who wears da pants']
|
58
|
+
answer_list = line_arg.map { |item| " " + item }
|
59
|
+
prefix_log_line_test_compare_helper(line_arg, answer_list)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'removes carriage returns' do
|
63
|
+
line_arg = " \r\n god doing this sucked"
|
64
|
+
answer = " \n god doing this sucked"
|
65
|
+
prefix_log_line_test_compare_helper(line_arg, answer)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'includes a newline at the end if it was on the input' do
|
69
|
+
line_arg = "why should this matter\n"
|
70
|
+
answer = " why should this matter\n"
|
71
|
+
prefix_log_line_test_compare_helper(line_arg, answer)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'prepends multiple lines in one string' do
|
75
|
+
line_arg = "\n\nwhy should this matter\n"
|
76
|
+
answer = " \n \n why should this matter\n"
|
77
|
+
prefix_log_line_test_compare_helper(line_arg, answer)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'can be nested' do
|
81
|
+
line_arg = "\n\nwhy should this matter"
|
82
|
+
answer = " \n \n why should this matter"
|
83
|
+
prefix_log_line_test_compare_helper(line_arg, answer, 3)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context '#step_* methods' do
|
88
|
+
it 'steps in correctly (simple case)' do
|
89
|
+
logger.instance_variable_set( :@line_prefix_length, 0 )
|
90
|
+
logger.step_in()
|
91
|
+
expect( logger.instance_variable_get( :@line_prefix_length ) ).to be === 2
|
92
|
+
expect( logger.line_prefix ).to be === ' '
|
93
|
+
logger.instance_variable_set( :@line_prefix_length, 0 )
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'sets length correctly in mixed scenario ' do
|
97
|
+
logger.instance_variable_set( :@line_prefix_length, 0 )
|
98
|
+
logger.step_in()
|
99
|
+
logger.step_in()
|
100
|
+
logger.step_out()
|
101
|
+
logger.step_in()
|
102
|
+
logger.step_in()
|
103
|
+
logger.step_out()
|
104
|
+
expect( logger.instance_variable_get( :@line_prefix_length ) ).to be === 4
|
105
|
+
expect( logger.line_prefix ).to be === ' '
|
106
|
+
logger.instance_variable_set( :@line_prefix_length, 0 )
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'can be unevenly stepped out, will remain at base: 0' do
|
110
|
+
logger.instance_variable_set( :@line_prefix_length, 0 )
|
111
|
+
logger.step_in()
|
112
|
+
10.times { logger.step_out() }
|
113
|
+
expect( logger.instance_variable_get( :@line_prefix_length ) ).to be === 0
|
114
|
+
expect( logger.line_prefix ).to be === ''
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
48
118
|
context 'new' do
|
49
119
|
it 'does not duplicate STDOUT when directly passed to it' do
|
50
120
|
stdout_logger = Logger.new STDOUT
|
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.25.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-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -276,6 +276,20 @@ dependencies:
|
|
276
276
|
- - ~>
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: '0.0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: beaker-hiera
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ~>
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0.0'
|
286
|
+
type: :runtime
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ~>
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0.0'
|
279
293
|
- !ruby/object:Gem::Dependency
|
280
294
|
name: rbvmomi
|
281
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -346,6 +360,20 @@ dependencies:
|
|
346
360
|
- - ! '>='
|
347
361
|
- !ruby/object:Gem::Version
|
348
362
|
version: '0'
|
363
|
+
- !ruby/object:Gem::Dependency
|
364
|
+
name: fog-google
|
365
|
+
requirement: !ruby/object:Gem::Requirement
|
366
|
+
requirements:
|
367
|
+
- - ~>
|
368
|
+
- !ruby/object:Gem::Version
|
369
|
+
version: 0.0.9
|
370
|
+
type: :runtime
|
371
|
+
prerelease: false
|
372
|
+
version_requirements: !ruby/object:Gem::Requirement
|
373
|
+
requirements:
|
374
|
+
- - ~>
|
375
|
+
- !ruby/object:Gem::Version
|
376
|
+
version: 0.0.9
|
349
377
|
- !ruby/object:Gem::Dependency
|
350
378
|
name: fog
|
351
379
|
requirement: !ruby/object:Gem::Requirement
|
@@ -460,7 +488,6 @@ files:
|
|
460
488
|
- lib/beaker/dsl/assertions.rb
|
461
489
|
- lib/beaker/dsl/helpers.rb
|
462
490
|
- lib/beaker/dsl/helpers/facter_helpers.rb
|
463
|
-
- lib/beaker/dsl/helpers/hiera_helpers.rb
|
464
491
|
- lib/beaker/dsl/helpers/host_helpers.rb
|
465
492
|
- lib/beaker/dsl/helpers/puppet_helpers.rb
|
466
493
|
- lib/beaker/dsl/helpers/test_helpers.rb
|
@@ -567,7 +594,6 @@ files:
|
|
567
594
|
- spec/beaker/dsl/assertions_spec.rb
|
568
595
|
- spec/beaker/dsl/ezbake_utils_spec.rb
|
569
596
|
- spec/beaker/dsl/helpers/facter_helpers_spec.rb
|
570
|
-
- spec/beaker/dsl/helpers/hiera_helpers_spec.rb
|
571
597
|
- spec/beaker/dsl/helpers/host_helpers_spec.rb
|
572
598
|
- spec/beaker/dsl/helpers/puppet_helpers_spec.rb
|
573
599
|
- spec/beaker/dsl/helpers/test_helpers_spec.rb
|