Skip to content

Commit

Permalink
Merge pull request #848 from shundhammer/huha-fix-unit-tests
Browse files Browse the repository at this point in the history
Force mocking x86_64 architecture for unit tests that depend on bcache
  • Loading branch information
ancorgs committed Feb 14, 2019
2 parents 5c04f6f + 67947f3 commit 5b14c69
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 1 deletion.
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Feb 14 17:03:05 UTC 2019 - Stefan Hundhammer <shundhammer@suse.com>

- Force mocking arch to x86_64 for unit tests that depend on bcache
(part of jsc#SLE-4329)
- 4.1.59

-------------------------------------------------------------------
Thu Feb 14 12:49:25 UTC 2019 - Stefan Hundhammer <shundhammer@suse.com>

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

Name: yast2-storage-ng
Version: 4.1.58
Version: 4.1.59
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
2 changes: 2 additions & 0 deletions test/y2partitioner/actions/add_bcache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
describe Y2Partitioner::Actions::AddBcache do
subject { described_class.new }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64

before do
devicegraph_stub(scenario)

Expand Down
2 changes: 2 additions & 0 deletions test/y2partitioner/actions/delete_bcache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

subject { described_class.new(device) }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64

let(:scenario) { "bcache1.xml" }

let(:device) { Y2Storage::BlkDevice.find_by_name(device_graph, device_name) }
Expand Down
1 change: 1 addition & 0 deletions test/y2partitioner/actions/edit_blk_device_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
end

context "and the device is a bcache device" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache1.xml" }
let(:dev_name) { "/dev/bcache1" }

Expand Down
1 change: 1 addition & 0 deletions test/y2partitioner/dialogs/bcache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
describe Y2Partitioner::Dialogs::Bcache do
before { devicegraph_stub("bcache1.xml") }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:suitable_backing) { fake_devicegraph.blk_devices }
let(:suitable_caching) { fake_devicegraph.blk_devices + fake_devicegraph.bcache_csets }

Expand Down
2 changes: 2 additions & 0 deletions test/y2partitioner/widgets/bcache_add_button_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
describe Y2Partitioner::Widgets::BcacheAddButton do
subject(:button) { described_class.new }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64

before do
devicegraph_stub("bcache1.xml")

Expand Down
2 changes: 2 additions & 0 deletions test/y2partitioner/widgets/bcache_device_description_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
describe Y2Partitioner::Widgets::BcacheDeviceDescription do
before { devicegraph_stub("bcache1.xml") }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64

let(:current_graph) { Y2Partitioner::DeviceGraphs.instance.current }

let(:bcache) { current_graph.bcaches.first }
Expand Down
1 change: 1 addition & 0 deletions test/y2partitioner/widgets/bcache_modify_button_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
describe Y2Partitioner::Widgets::BcacheModifyButton do
before { devicegraph_stub("bcache1.xml") }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:current_graph) { Y2Partitioner::DeviceGraphs.instance.current }
let(:device) { current_graph.bcaches.first }

Expand Down
1 change: 1 addition & 0 deletions test/y2partitioner/widgets/device_buttons_set_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
describe Y2Partitioner::Widgets::DeviceButtonsSet do
before { devicegraph_stub(scenario) }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "nested_md_raids" }
let(:device_graph) { Y2Partitioner::DeviceGraphs.instance.current }
let(:pager) { Y2Partitioner::Widgets::OverviewTreePager.new("hostname") }
Expand Down
2 changes: 2 additions & 0 deletions test/y2partitioner/widgets/pages/bcache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
devicegraph_stub(scenario)
end

let(:architecture) { :x86_64 } # bcache is only supported on x86_64

let(:scenario) { "bcache2.xml" }

let(:current_graph) { Y2Partitioner::DeviceGraphs.instance.current }
Expand Down
3 changes: 3 additions & 0 deletions test/y2partitioner/widgets/pages/bcaches_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

describe Y2Partitioner::Widgets::Pages::Bcaches do
before { devicegraph_stub(scenario) }

let(:architecture) { :x86_64 } # bcache is only supported on x86_64

let(:scenario) { "bcache1.xml" }

let(:device_graph) { Y2Partitioner::DeviceGraphs.instance.current }
Expand Down
1 change: 1 addition & 0 deletions test/y2partitioner/widgets/pages/system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def row_names(table)
end

context "when there are bcache devices" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache1.xml" }

it "contains all bcache devices" do
Expand Down
6 changes: 6 additions & 0 deletions test/y2storage/blk_device_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
end

describe "#bcache" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache2.xml" }

context "when the device is not used as backing device by a bcache" do
Expand Down Expand Up @@ -810,6 +811,7 @@
end

context "for a disk that is used as backing device for a bcache" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache1.xml" }
let(:device_name) { "/dev/vdc" }

Expand All @@ -821,6 +823,7 @@
end

context "for a disk that is used as caching device for a bcache" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache1.xml" }
let(:device_name) { "/dev/vdb" }

Expand All @@ -832,6 +835,7 @@
end

context "for a bcache device not used in an LVM or in a RAID" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache1.xml" }
let(:device_name) { "/dev/bcache0" }

Expand All @@ -846,6 +850,7 @@

describe "#component_of_names" do
context "component has name" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache1.xml" }
let(:device_name) { "/dev/vdc" }

Expand All @@ -856,6 +861,7 @@
end

context "component has display name" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
let(:scenario) { "bcache1.xml" }
let(:device_name) { "/dev/vdb" }

Expand Down
3 changes: 3 additions & 0 deletions test/y2storage/devicegraph_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ def with_sda2_deleted(initial_graph)
end

describe "#remove_bcache" do
let(:architecture) { :x86_64 } # bcache is only supported on x86_64
subject(:devicegraph) { Y2Storage::StorageManager.instance.staging }

before do
Expand Down Expand Up @@ -925,6 +926,7 @@ def create_partition(disk)
fake_scenario("bcache1.xml")
end

let(:architecture) { :x86_64 } # bcache is only supported on x86_64
subject(:list) { fake_devicegraph.bcaches }

it "returns an array of bcache devices" do
Expand All @@ -948,6 +950,7 @@ def create_partition(disk)
fake_scenario("bcache1.xml")
end

let(:architecture) { :x86_64 } # bcache is only supported on x86_64
subject(:list) { fake_devicegraph.bcache_csets }

it "returns an array of bcache csets" do
Expand Down

0 comments on commit 5b14c69

Please sign in to comment.