mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-10 00:27:05 +02:00
Now default is not to follow the logs (which is similar to `kubectl logs`). Integration test was added for `Logs()` API and `osctl logs` command. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
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/.
|
|
|
|
// +build integration_cli
|
|
|
|
package cli
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/talos-systems/talos/internal/integration/base"
|
|
)
|
|
|
|
// LogsSuite verifies logs command
|
|
type LogsSuite struct {
|
|
base.CLISuite
|
|
}
|
|
|
|
// SuiteName ...
|
|
func (suite *LogsSuite) SuiteName() string {
|
|
return "cli.LogsSuite"
|
|
}
|
|
|
|
// TestServiceLogs verifies that logs are displayed.
|
|
func (suite *LogsSuite) TestServiceLogs() {
|
|
suite.RunOsctl([]string{"logs", "kubelet"}) // default checks for stdout not empty
|
|
}
|
|
|
|
// TestServiceNotFound verifies that logs displays an error if service is not found.
|
|
func (suite *LogsSuite) TestServiceNotFound() {
|
|
suite.RunOsctl([]string{"logs", "servicenotfound"},
|
|
base.ShouldFail(),
|
|
base.StdoutEmpty(),
|
|
base.StderrNotEmpty(),
|
|
base.StderrShouldMatch(regexp.MustCompile("error getting logs: .*servicenotfound.log: no such file or directory")),
|
|
)
|
|
}
|
|
|
|
func init() {
|
|
allSuites = append(allSuites, new(LogsSuite))
|
|
}
|