-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use default time servers in time API if none are configured
This fixes simple bug: ``` $ talosctl -n 172.20.0.2 time error fetching time: 1 error occurred: * 172.20.0.2: rpc error: code = Unknown desc = no time servers configured ``` After the change: ``` $ talosctl -n 172.20.0.2 time NODE NTP-SERVER NODE-TIME NTP-SERVER-TIME 172.20.0.2 pool.ntp.org 2021-12-10 14:25:38.871656717 +0000 UTC 2021-12-10 14:25:38.92119139 +0000 UTC ``` Signed-off-by: Andrey Smirnov <[email protected]>
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
//go:build integration_cli | ||
// +build integration_cli | ||
|
||
package cli | ||
|
||
import ( | ||
"regexp" | ||
|
||
"github.com/talos-systems/talos/internal/integration/base" | ||
) | ||
|
||
// TimeSuite verifies dmesg command. | ||
type TimeSuite struct { | ||
base.CLISuite | ||
} | ||
|
||
// SuiteName ... | ||
func (suite *TimeSuite) SuiteName() string { | ||
return "cli.TimeSuite" | ||
} | ||
|
||
// TestDefault runs default time check. | ||
func (suite *TimeSuite) TestDefault() { | ||
suite.RunCLI([]string{"time", "--nodes", suite.RandomDiscoveredNode()}, | ||
base.StdoutShouldMatch(regexp.MustCompile(`NTP-SERVER`)), | ||
base.StdoutShouldMatch(regexp.MustCompile(`UTC`)), | ||
) | ||
} | ||
|
||
func init() { | ||
allSuites = append(allSuites, new(TimeSuite)) | ||
} |