Permalink
Browse files

Convert path test to inspec and make it work on Chef 13+

Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information...
tas50 committed May 29, 2018
1 parent ede9998 commit b5c997a68fe6b1576597cd36122dc167d9db69d7
View
@@ -16,23 +16,31 @@ Lint/UselessAssignment:
Metrics/BlockNesting:
Max: 5
Style/AccessorMethodName:
Naming/AccessorMethodName:
Exclude:
- 'libraries/version.rb'
Style/ClassVars:
Exclude:
- 'libraries/registry_helper.rb'
Style/GuardClause:
Exclude:
- 'libraries/registry_helper.rb'
- 'libraries/windows_privileged.rb'
Style/IfInsideElse:
Exclude:
- 'libraries/powershell_helper.rb'
Style/IfUnlessModifier:
Exclude:
- 'libraries/registry_helper.rb'
- 'libraries/version.rb'
- 'libraries/windows_helper.rb'
- 'libraries/windows_privileged.rb'
- 'providers/dns.rb'
- 'resources/certificate_binding.rb'
- 'resources/pagefile.rb'
- 'resources/task.rb'
- 'resources/zipfile.rb'
Style/RegexpLiteral:
Exclude:
- 'resources/task.rb'
- 'test/**/*.rb'
@@ -21,14 +21,3 @@
$env:path -split ';' | out-file c:\\paths.txt
EOH
end
windows_task 'testpath' do
action [:create, :run]
command 'powershell.exe -command $env:path > c:\\external_paths.txt'
end
ruby_block 'wait for task' do
block do
sleep 2
end
end
@@ -4,5 +4,5 @@
describe command('wmic pagefileset') do
its('exit_status') { should eq 0 } # if it was system managed it would be 1
its('stderr') { should_not match (/No Instance\(s\) Available/) } # not system managed
its('stderr') { should_not match /No Instance\(s\) Available/ } # not system managed
end
@@ -0,0 +1,6 @@
describe file('c:/paths.txt') do
it { should exist }
its('content') { should match(/C:\\path_test_path/) }
its('content') { should match(/c:\\path_test_with_forward_slashes/) }
its('content') { should match(/C:\\path_test_another_path/) }
end

This file was deleted.

Oops, something went wrong.
@@ -1,8 +1,8 @@
describe command('net share') do
its('exit_status') { should eq 0 }
its('stdout') { should_not match (/^no share/) }
its('stdout') { should match (/^change\s*C:\/test_share*/) }
its('stdout') { should match (/^changed_dir\s*C:\/test_share*/) }
its('stdout') { should match (/^read_only\s*C:\/test_share*/) }
its('stdout') { should match (/^full\s*C:\/test_share*/) }
its('stdout') { should_not match /^no share/ }
its('stdout') { should match /^change\s*C:\/test_share*/ }
its('stdout') { should match /^changed_dir\s*C:\/test_share*/ }
its('stdout') { should match /^read_only\s*C:\/test_share*/ }
its('stdout') { should match /^full\s*C:\/test_share*/ }
end

0 comments on commit b5c997a

Please sign in to comment.