mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-08 07:37:06 +02:00
This keeps backwards compatibility with `osctl` CLI binary with the exception of `osctl config generate` which was renamed to `osctl gen config` to avoid confusion with other `osctl config` commands which operate on client config, not Talos server config. Command implementation and helpers were split into subpackages for cleaner code and more visible boundaries. The resulting binary still combines commands from both sections into a single binary. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
59 lines
1.4 KiB
Go
59 lines
1.4 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 (
|
|
"io/ioutil"
|
|
"os"
|
|
|
|
"github.com/talos-systems/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"
|
|
}
|
|
|
|
func (suite *ValidateSuite) SetupTest() {
|
|
var err error
|
|
suite.tmpDir, err = ioutil.TempDir("", "talos")
|
|
suite.Require().NoError(err)
|
|
|
|
suite.savedCwd, err = os.Getwd()
|
|
suite.Require().NoError(err)
|
|
|
|
suite.Require().NoError(os.Chdir(suite.tmpDir))
|
|
}
|
|
|
|
func (suite *ValidateSuite) TearDownTest() {
|
|
suite.Require().NoError(os.Chdir(suite.savedCwd))
|
|
suite.Require().NoError(os.RemoveAll(suite.tmpDir))
|
|
}
|
|
|
|
// TestValidate generates config and validates it for all the modes.
|
|
func (suite *ValidateSuite) TestValidate() {
|
|
suite.RunOsctl([]string{"gen", "config", "foobar", "https://10.0.0.1"})
|
|
|
|
for _, configFile := range []string{"init.yaml", "controlplane.yaml", "join.yaml"} {
|
|
for _, mode := range []string{"Cloud", "Container", "Interactive", "Metal"} {
|
|
suite.RunOsctl([]string{"validate", "-m", mode, "-c", configFile})
|
|
}
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
allSuites = append(allSuites, new(ValidateSuite))
|
|
}
|