Skip to content

Commit

Permalink
Merge pull request #1006 from ancorgs/missing_require
Browse files Browse the repository at this point in the history
Add missing require clause (bsc#1160362)
  • Loading branch information
ancorgs committed Jan 9, 2020
2 parents d42204c + 2ed00bb commit 799e67f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions library/packages/src/lib/y2packager/product_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
require "y2packager/product"
require "y2packager/product_sorter"
require "y2packager/resolvable"
require "y2packager/product_control_product"

Yast.import "Pkg"
Yast.import "Linuxrc"
Expand Down
35 changes: 35 additions & 0 deletions library/packages/test/y2packager/product_reader_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,41 @@

expect(subject.all_products.size).to eq(1)
end

# Smoke test. There was a missing "require" clause in one part of the code.
# This context ensures that part is executed in the tests, basically to
# make sure the "require" is not forgotten (bsc#1160362). But the tests on
# this context do not guarantee the code is working correctly in all cases.
# They only test a simplistic case with quite some mocking.
context "with the online media and no base product" do
# FIXME: needed because MediumType is wrongly located in yast2-packager
module Y2Packager
class MediumType
def self.online?
true
end
end
end

before do
allow(Yast::Stage).to receive(:initial).and_return true

# The tests at test/y2packager/product_control_product_test.rb mock
# this to always be an array. Let's copy the most simplistic of those
# mocks.
allow(Yast::ProductFeatures).to receive(:GetFeature)
.with("software", "base_products").and_return([])
end

after do
# the read products are cached, we need to reset them manually for the next test
Y2Packager::ProductControlProduct.instance_variable_set(:@products, nil)
end

it "does not crash" do
expect { subject.all_products }.to_not raise_error
end
end
end

describe ".installation_package_mapping" do
Expand Down
7 changes: 7 additions & 0 deletions package/yast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jan 8 16:27:59 UTC 2020 - Ancor Gonzalez Sosa <ancor@suse.com>

- Fix an exception in the live installation caused by a missing
"require" clause (bsc#1160362).
- 4.2.51

-------------------------------------------------------------------
Mon Jan 6 15:03:45 UTC 2020 - Ladislav Slezák <lslezak@suse.cz>

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


Name: yast2
Version: 4.2.50
Version: 4.2.51
Release: 0
Summary: YaST2 Main Package
License: GPL-2.0-only
Expand Down

0 comments on commit 799e67f

Please sign in to comment.