talos/internal/integration/base/cli.go
Andrey Smirnov 551fa45d33 test: add CLI integration test
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>
2019-11-05 17:59:23 -08:00

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