File tree Expand file tree Collapse file tree 5 files changed +12
-9
lines changed Expand file tree Collapse file tree 5 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,11 @@ group :test do
2323end
2424
2525group :acceptance do
26- # Litmus has dependencies which require Ruby 2.5 (Puppet 6) or above.
27- gem 'puppet_litmus' if Gem ::Version . new ( RUBY_VERSION . dup ) >= Gem ::Version . new ( '2.5.0' )
26+ if Gem ::Version . new ( RUBY_VERSION . dup ) >= Gem ::Version . new ( '2.5.0' )
27+ # Litmus has dependencies which require Ruby 2.5 (Puppet 6) or above.
28+ gem 'puppet_litmus' , '~> 0.11' , '>= 0.11.1'
29+ gem 'net-ssh' , '~> 5.2'
30+ end
2831end
2932
3033group :development do
Original file line number Diff line number Diff line change 4949 { :title => '--emit-json-stdout' , :cmd_line => '--emit-json-stdout' }
5050 ] . each do |testcase |
5151 it "should emit JSON to stdout when using #{ testcase [ :title ] } " do
52- output = PuppetLitmus ::Serverspec . run_shell ( "puppet strings generate #{ testcase [ :cmd_line ] } \" #{ @test_module_path } /lib/puppet/parser/functions/function3x.rb\" " ) . stdout . chomp
52+ output = PuppetLitmus ::PuppetHelpers . run_shell ( "puppet strings generate #{ testcase [ :cmd_line ] } \" #{ @test_module_path } /lib/puppet/parser/functions/function3x.rb\" " ) . stdout . chomp
5353 expect ( JSON . parse ( output ) ) . to eq ( expected )
5454 end
5555 end
6161 it "should write JSON to a file when using #{ testcase [ :title ] } " do
6262 tmpfile = File . join ( @remote_tmp_path , 'json_output.json' )
6363 cmd = "puppet strings generate #{ testcase [ :cmd_line ] . gsub ( 'TMPFILE' , tmpfile ) } \" #{ @test_module_path } /lib/puppet/parser/functions/function3x.rb\" "
64- PuppetLitmus ::Serverspec . run_shell ( cmd )
64+ PuppetLitmus ::PuppetHelpers . run_shell ( cmd )
6565 output = JSON . parse ( file ( tmpfile ) . content )
6666 expect ( output ) . to eq ( expected )
6767 end
Original file line number Diff line number Diff line change @@ -35,13 +35,13 @@ class { "test": }
3535
3636 it 'should render Markdown to stdout when using --format markdown' do
3737 skip ( 'This test is broken. Does not output to STDOUT by default.' )
38- output = PuppetLitmus ::Serverspec . run_shell ( "puppet strings generate --format markdown \" #{ @test_module_path } /manifests/init.pp\" " ) . stdout . chomp
38+ output = PuppetLitmus ::PuppetHelpers . run_shell ( "puppet strings generate --format markdown \" #{ @test_module_path } /manifests/init.pp\" " ) . stdout . chomp
3939 expect ( output ) . to eq ( expected )
4040 end
4141
4242 it 'should write Markdown to a file when using --format markdown and --out' do
4343 tmpfile = File . join ( @remote_tmp_path , 'md_output.md' )
44- remote = PuppetLitmus ::Serverspec . run_shell ( "puppet strings generate --format markdown --out \" #{ tmpfile } \" \" #{ @test_module_path } /manifests/init.pp\" " )
44+ remote = PuppetLitmus ::PuppetHelpers . run_shell ( "puppet strings generate --format markdown --out \" #{ tmpfile } \" \" #{ @test_module_path } /manifests/init.pp\" " )
4545 expect ( file ( tmpfile ) ) . to contain expected
4646 end
4747end
Original file line number Diff line number Diff line change 44describe 'Generating module documentation using generate action' do
55 before :all do
66 # TODO: Linux only
7- @sut_work_dir = PuppetLitmus ::Serverspec . run_shell ( "pwd" ) . stdout . chomp
7+ @sut_work_dir = PuppetLitmus ::PuppetHelpers . run_shell ( "pwd" ) . stdout . chomp
88
99 test_module_path = sut_module_path ( /Module test/ )
10- PuppetLitmus ::Serverspec . run_shell ( "puppet strings generate \" #{ test_module_path } /**/*.{rb,pp}\" " )
10+ PuppetLitmus ::PuppetHelpers . run_shell ( "puppet strings generate \" #{ test_module_path } /**/*.{rb,pp}\" " )
1111 end
1212
1313 def expect_file_contain ( path , expected_contents )
Original file line number Diff line number Diff line change 11def sut_module_path ( module_regex )
2- modules = JSON . parse ( PuppetLitmus ::Serverspec . run_shell ( 'puppet module list --render-as json' ) . stdout )
2+ modules = JSON . parse ( PuppetLitmus ::PuppetHelpers . run_shell ( 'puppet module list --render-as json' ) . stdout )
33 test_module_info = modules [ 'modules_by_path' ] . values . flatten . find { |mod_info | mod_info =~ module_regex }
44 test_module_info . match ( /\( ([^)]*)\) / ) [ 1 ]
55end
You can’t perform that action at this time.
0 commit comments