talos/internal/integration/cli/validate.go
Andrey Smirnov 7f0300f108
feat: update dependencies, Kubernetes 1.34.0-alpha.2
Bump all dependencies, many small changes due to new golangci-lint
version.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2025-06-30 19:05:22 +04:00

67 lines
1.5 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/.
//go:build integration_cli
package cli
import (
"fmt"
"os"
"github.com/siderolabs/talos/internal/integration/base"
)
// ValidateSuite verifies dmesg command.
type ValidateSuite struct {
base.CLISuite
tmpDir string
savedCwd string
}
// SuiteName ...
func (suite *ValidateSuite) SuiteName() string {
return "cli.ValidateSuite"
}
// SetupTest ...
func (suite *ValidateSuite) SetupTest() {
suite.tmpDir = suite.T().TempDir()
var err error
suite.savedCwd, err = os.Getwd()
suite.Require().NoError(err)
suite.Require().NoError(os.Chdir(suite.tmpDir))
}
// TearDownTest ...
func (suite *ValidateSuite) TearDownTest() {
if suite.savedCwd != "" {
suite.Require().NoError(os.Chdir(suite.savedCwd))
}
}
// TestValidate generates config and validates it for all the modes.
func (suite *ValidateSuite) TestValidate() {
suite.RunCLI([]string{"gen", "config", "foobar", "https://10.0.0.1"},
base.StdoutEmpty(),
base.StderrNotEmpty(),
)
for _, configFile := range []string{"controlplane.yaml", "worker.yaml"} {
for _, mode := range []string{"cloud", "metal"} {
suite.Run(fmt.Sprintf("%s-%s", configFile, mode), func() {
suite.RunCLI([]string{"validate", "-m", mode, "-c", configFile, "--strict"})
})
}
}
}
func init() {
allSuites = append(allSuites, new(ValidateSuite))
}