Skip to content

Commit

Permalink
Use exact expectations in perf_spec
Browse files Browse the repository at this point in the history
This makes it easier to debug when they don't match.
  • Loading branch information
ekohl committed Jul 24, 2024
1 parent 2be5851 commit 07fa172
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/beaker/perf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module Beaker
@my_logger.remove_destination(STDOUT)
perf = described_class.new(hosts, @options)
expect(perf).to be_a described_class
expect(@my_io.string).to match(/Setup perf on host: myHost/)
expect(@my_io.string).to eq("Setup perf on host: myHost\n")
end

it 'creates a new Perf object with multiple hosts' do
Expand All @@ -39,7 +39,7 @@ module Beaker
@my_logger.remove_destination(STDOUT)
perf = described_class.new(hosts, @options)
expect(perf).to be_a described_class
expect(@my_io.string).to match(/Setup perf on host: myHost*\nSetup perf on host: myOtherHost/)
expect(@my_io.string).to eq("Setup perf on host: myHost\nSetup perf on host: myOtherHost\n")
end

it 'creates a new Perf object with multiple hosts, SLES' do
Expand All @@ -50,7 +50,7 @@ module Beaker
@my_logger.remove_destination(STDOUT)
perf = described_class.new(hosts, @options)
expect(perf).to be_a described_class
expect(@my_io.string).to match(/Setup perf on host: myHost\nSetup perf on host: myOtherHost/)
expect(@my_io.string).to include("Setup perf on host: myHost\nSetup perf on host: myOtherHost\n")
end
end

Expand All @@ -73,7 +73,7 @@ module Beaker
perf = described_class.new(@hosts, @options)
expect(perf).to be_a described_class
perf.print_perf_info
expect(@my_io.string).to match(/Setup perf on host: myHost\nSetup perf on host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost\nGetting perf data for host: myHost\nGetting perf data for host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost/)
expect(@my_io.string).to eq("Setup perf on host: myHost\nSetup perf on host: myOtherHost\nPerf (sysstat) not supported on host: myOtherHost\nGetting perf data for host: myHost\nGetting perf data for host: myOtherHost\nPerf (sysstat) not supported on host: myOtherHost\n")
end

it "Does the Right Thing on non-Linux hosts" do
Expand All @@ -82,7 +82,7 @@ module Beaker
perf = described_class.new(@hosts, @options)
expect(perf).to be_a described_class
perf.print_perf_info
expect(@my_io.string).to match(/Setup perf on host: myHost\nPerf \(sysstat\) not supported on host: myHost\nSetup perf on host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost\nGetting perf data for host: myHost\nPerf \(sysstat\) not supported on host: myHost\nGetting perf data for host: myOtherHost\nPerf \(sysstat\) not supported on host: myOtherHost/)
expect(@my_io.string).to eq("Setup perf on host: myHost\nPerf (sysstat) not supported on host: myHost\nSetup perf on host: myOtherHost\nPerf (sysstat) not supported on host: myOtherHost\nGetting perf data for host: myHost\nPerf (sysstat) not supported on host: myHost\nGetting perf data for host: myOtherHost\nPerf (sysstat) not supported on host: myOtherHost\n")
end
end
end
Expand Down

0 comments on commit 07fa172

Please sign in to comment.