Skip to content

Commit

Permalink
Master bsc 1113732 (#875)
Browse files Browse the repository at this point in the history
* Sle 15 ga 1113732 (#870)
  • Loading branch information
schubi2 committed Dec 13, 2018
1 parent d5e53a9 commit 6a7d4bb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion library/systemd/src/lib/yast2/system_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def build(name)
#
# @param names [Array<String>] service names to find
#
# @return [Array<SystemService>]
# @return [Array<SystemService>] when not found then the SystemService.servie is nil for the respective service in the list
def find_many(names)
Yast2::Systemd::Service.find_many(names).map { |s| new(s) }
end
Expand Down
29 changes: 22 additions & 7 deletions library/systemd/test/yast2/system_service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,30 @@
let(:apparmor) { instance_double(Yast2::Systemd::Service) }
let(:cups) { instance_double(Yast2::Systemd::Service) }

before do
allow(Yast2::Systemd::Service).to receive(:find_many).with(["apparmor", "cups"])
.and_return([apparmor, cups])
context "services can be found on the system" do
before do
allow(Yast2::Systemd::Service).to receive(:find_many).with(["apparmor", "cups"])
.and_return([apparmor, cups])
end

it "finds a set of systemd services" do
system_services = described_class.find_many(["apparmor", "cups"])
expect(system_services).to be_all(Yast2::SystemService)
expect(system_services.map(&:service)).to eq([apparmor, cups])
end
end

it "finds a set of systemd services" do
system_services = described_class.find_many(["apparmor", "cups"])
expect(system_services).to be_all(Yast2::SystemService)
expect(system_services.map(&:service)).to eq([apparmor, cups])
context "no service can be found on the system" do
before do
allow(Yast2::Systemd::Service).to receive(:find_many).with(["apparmor", "cups"])
.and_return([nil, nil])
end

it "returns a list of empty/nil services" do
system_services = described_class.find_many(["apparmor", "cups"])
expect(system_services).to be_all(Yast2::SystemService)
expect(system_services.map(&:service)).to eq([nil, nil])
end
end
end

Expand Down
6 changes: 6 additions & 0 deletions package/yast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Dec 12 15:36:34 UTC 2018 - schubi@suse.de

- Added more testcases if e.g. system is running in chroot
environment and systemd does not work properly (bsc#1113732)

-------------------------------------------------------------------
Wed Dec 12 14:17:02 UTC 2018 - Stefan Hundhammer <shundhammer@suse.com>

Expand Down

0 comments on commit 6a7d4bb

Please sign in to comment.