Skip to content

Commit

Permalink
Merge pull request #1361 from yast/test_performance
Browse files Browse the repository at this point in the history
Speed-up tests a bit in systems with slow hwinfo
  • Loading branch information
ancorgs authored Oct 18, 2023
2 parents 5ba6fc2 + 1365974 commit c7d9c4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def run; end
end
end

allow(Y2Storage::HWInfoReader.instance).to receive(:for_device)
.and_return Y2Storage::HWInfoDisk.new

# Bcache is only supported for x86_64 architecture. Probing the devicegraph complains if Bcache is
# used with another architecture. Bcache error is avoided here. Otherwise, x86_84 architecture must
# to be set for every test using Bcache (which has demonstrated to be quite error prone).
Expand Down
3 changes: 3 additions & 0 deletions test/y2storage/hwinfo_reader_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
let(:hwinfo_file) { "hwinfo.txt" }

before do
# Disable the global mock that normally prevents calls to hwinfo
allow(reader).to receive(:for_device).and_call_original

allow(Yast::Execute).to receive(:on_target!)
.with(/hwinfo/, anything, anything, anything).and_return(hwinfo_output)
reader.reset
Expand Down

0 comments on commit c7d9c4a

Please sign in to comment.