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

Master bsc 1113732 #875

Merged
merged 3 commits into from
Dec 13, 2018
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
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