talos/internal/integration/cli/time.go
Andrey Smirnov ec641f7296
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 <andrey.smirnov@talos-systems.com>
2021-12-10 17:39:36 +03:00

37 lines
856 B
Go

// 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))
}