Skip to content

Commit

Permalink
Changes based on CR.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Nov 12, 2018
1 parent 428f1f0 commit 2f806be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/modules/Lan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def dhcp_ntp_servers
return [] if !NetworkService.isNetworkRunning || Yast::NetworkService.is_network_manager

ReadWithCacheNoGUI()
Yast::LanItems.dhcp_ntp_servers.values.reduce(&:concat) || []
Yast::LanItems.dhcp_ntp_servers.values.flatten.uniq
end

publish variable: :ipv6, type: "boolean"
Expand Down
6 changes: 3 additions & 3 deletions test/lan_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,14 @@ def expect_modification_succeedes(modname, method)
let(:servers) do
{
"eth0" => ["0.pool.ntp.org", "1.pool.ntp.org"],
"eth1" => ["2.pool.ntp.org"]
"eth1" => ["1.pool.ntp.org", "2.pool.ntp.org"]
}
end

before do
allow(Yast::NetworkService).to receive(:isNetworkRunning).and_return(running)
allow(Yast::NetworkService).to receive(:is_network_manager).and_return(nm_enabled)
allow(Yast::LanItems).to receive(:dhcp_ntp_servers).and_return(servers)
end

context "when the network is not running" do
Expand All @@ -484,8 +485,7 @@ def expect_modification_succeedes(modname, method)
end

it "returns a list of the ntp_servers provided by dhcp " do
expect(Yast::LanItems).to receive(:dhcp_ntp_servers).and_return(servers)
expect(subject.dhcp_ntp_servers)
expect(subject.dhcp_ntp_servers.sort)
.to eql(["0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org"])
end
end
Expand Down

0 comments on commit 2f806be

Please sign in to comment.