Skip to content

Commit

Permalink
Modify pipe tests for more clarity
Browse files Browse the repository at this point in the history
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
  • Loading branch information
jerryaldrichiii committed Nov 30, 2017
1 parent ab34ccc commit a8071fb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/windows/local_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@
# Must call `:conn` early so we can stub `SecureRandom`
connection = conn

# Verify pipe is created by using PowerShell to check pipe location
# Verify pipe was created by using PowerShell to check pipe location. This
# works by intercepting the `SecureRandom` call which controls the pipe
# name. If this command uses a pipe, then the `stdout` of this command will
# not be `''`.
SecureRandom.expects(:hex).returns('with_pipe')
cmd = connection.run_command('Get-ChildItem //./pipe/ | Where-Object { $_.Name -Match "inspec_with_pipe" }')
cmd.stdout.wont_be_nil
cmd.stdout.wont_equal ''
cmd.stderr.must_equal ''
end

Expand All @@ -61,7 +64,10 @@
.expects(:acquire_pipe)
.returns(nil)

# Verify pipe was not created by using PowerShell to check pipe location
# Verify pipe was not created by using PowerShell to check pipe location.
# This works by intercepting the `SecureRandom` call which controls the pipe
# name. If this command doesn't find a pipe, then the `stdout` of the
# command will be `''`.
SecureRandom.stubs(:hex).returns('minitest')
cmd = connection.run_command('Get-ChildItem //./pipe/ | Where-Object { $_.Name -Match "inspec_minitest" }')
cmd.stdout.must_equal ''
Expand Down

0 comments on commit a8071fb

Please sign in to comment.