Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-up tests a bit in systems with slow hwinfo #1361

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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