Skip to content

Commit

Permalink
Merge pull request #460 from yast/mock_arch
Browse files Browse the repository at this point in the history
Fixed an unit test to work also on non-x86_64 archs
  • Loading branch information
lslezak committed Jul 15, 2019
2 parents 8275a22 + e5c9a3f commit 47b5ef1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
7 changes: 7 additions & 0 deletions package/yast2-packager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Jul 15 14:02:57 UTC 2019 - Ladislav Slezák <lslezak@suse.cz>

- Fixed the unit test for the previous change to work also on
other architectures than x86_64 (related to bsc#1141414)
- 4.2.18

-------------------------------------------------------------------
Thu Jul 11 07:17:45 UTC 2019 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-packager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 4.2.17
Version: 4.2.18
Release: 0
Summary: YaST2 - Package Library
License: GPL-2.0-or-later
Expand Down
22 changes: 16 additions & 6 deletions test/product_location_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@ def find_product(arr, product)
arr.find { |p| p.details.product == product }
end

# loading all repositories and evaluating the product dependencies
# using the solver takes some time, run it only once and cache
# the result for all tests
dir = File.join(__dir__, "data/zypp/test_offline_repo")
repo_url = "dir://#{URI.escape(dir)}"
scan_result = Y2Packager::ProductLocation.scan(repo_url)
# URL of the local testing repository
REPO_URL = "dir://#{URI.escape(File.join(DATA_PATH, "zypp/test_offline_repo"))}".freeze

describe Y2Packager::ProductLocation do
let(:scan_result) { Y2Packager::ProductLocation.scan(REPO_URL) }

before do
# the testing repository only contains the x86_64 packages/products
# and the solver ignores the packages for incompatible architectures,
# that means the test would fail anywhere except on x86_64.
#
# So we modify the "setarch" call to always pass the "x86_64" parameter.
allow_any_instance_of(::Solv::Pool).to receive(:setarch)
.and_wrap_original do |method, *_args|
method.call("x86_64")
end
end

describe ".scan" do
it "finds all product repositories" do
# there are 3 testing product repositories
Expand Down

0 comments on commit 47b5ef1

Please sign in to comment.