Skip to content

Commit

Permalink
Merge d322720 into 38a5067
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 4, 2021
2 parents 38a5067 + d322720 commit 6b91e3c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
6 changes: 6 additions & 0 deletions package/yast2-ntp-client.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue May 4 10:22:49 UTC 2021 - Knut Anderssen <kanderssen@suse.com>

- Adapted proposal client returning the dhcp ntp servers as strings
- 4.3.3 (bsc#1185545)

-------------------------------------------------------------------
Wed Feb 17 21:19:33 UTC 2021 - Josef Reidinger <jreidinger@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-ntp-client.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-ntp-client
Version: 4.3.2
Version: 4.3.3
Release: 0
Summary: YaST2 - NTP Client Configuration
License: GPL-2.0-or-later
Expand Down
2 changes: 1 addition & 1 deletion src/clients/ntp-client_proposal.rb
Expand Up @@ -60,7 +60,7 @@ def main
NtpClient.ntp_selected = Ops.get_boolean(@param, "ntp_used", false)
@ret = true
when "dhcp_ntp_servers"
@ret = NtpClient.dhcp_ntp_servers
@ret = NtpClient.dhcp_ntp_servers.map(&:hostname)
when "MakeProposal"
@ret = MakeProposal()
when "Write"
Expand Down
29 changes: 25 additions & 4 deletions test/ntp_client_proposal_test.rb
Expand Up @@ -13,15 +13,36 @@
client
end

let(:dhcp_ntp_servers) { [] }

before do
allow(Yast::Lan).to receive(:dhcp_ntp_servers)
.and_return(dhcp_ntp_servers)
end

describe "#main" do
let(:client) { described_class.new }
let(:func) { "dhcp_ntp_servers" }

before do
allow(Yast::WFM).to receive(:Args).with(no_args).and_return([func])
allow(Yast::WFM).to receive(:Args).with(0).and_return(func)
end

context "when call with 'dhcp_ntp_servers' argument" do
let(:dhcp_ntp_servers) { ["test.example.net", "test2.example.net"] }

it "returns servers found via DHCP" do
expect(client.main).to eql(dhcp_ntp_servers)
end
end
end

describe "#MakeProposal" do
let(:dhcp_ntp_servers) { [] }
let(:config_was_read?) { false }
let(:ntp_was_selected?) { false }

before do
allow(Yast::Lan).to receive(:dhcp_ntp_servers)
.and_return(dhcp_ntp_servers)

allow(Yast::NtpClient).to receive(:country_ntp_servers).with("de")
.and_return([Y2Network::NtpServer.new("de.pool.ntp.org")])
allow(Yast::Timezone).to receive(:timezone).and_return("Europe/Berlin")
Expand Down

0 comments on commit 6b91e3c

Please sign in to comment.