mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-10 16:47:04 +02:00
This starts with a very simple test for `osctl version` using regexps as output of the command depends a lot on current version. We might use more of 'gold' matches for other commands potentially. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
33 lines
790 B
Go
33 lines
790 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/.
|
|
|
|
// +build integration_cli
|
|
|
|
package base
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
)
|
|
|
|
// CLISuite is a base suite for CLI tests
|
|
type CLISuite struct {
|
|
suite.Suite
|
|
TalosSuite
|
|
}
|
|
|
|
// RunOsctl runs osctl binary with the options provided
|
|
func (cliSuite *CLISuite) RunOsctl(args []string, options ...RunOption) {
|
|
if cliSuite.Target != "" {
|
|
args = append([]string{"--target", cliSuite.Target}, args...)
|
|
}
|
|
|
|
args = append([]string{"--talosconfig", cliSuite.TalosConfig}, args...)
|
|
|
|
cmd := exec.Command(cliSuite.OsctlPath, args...)
|
|
|
|
Run(&cliSuite.Suite, cmd, options...)
|
|
}
|