-
Notifications
You must be signed in to change notification settings - Fork 158
/
tests.go
41 lines (30 loc) · 1.03 KB
/
tests.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package tests
import (
"github.com/scylladb/scylla-operator/pkg/cmdutil"
"github.com/scylladb/scylla-operator/pkg/genericclioptions"
"github.com/spf13/cobra"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubectl/pkg/util/templates"
)
const (
EnvVarPrefix = "SCYLLA_OPERATOR_TESTS_"
)
func NewTestsCommand(streams genericclioptions.IOStreams) *cobra.Command {
cmd := &cobra.Command{
Use: "scylla-operator-tests",
Long: templates.LongDesc(`
Scylla operator tests
This command verifies behavior of an scylla-operator by running remote tests on a Kubernetes cluster.
`),
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return cmdutil.ReadFlagsFromEnv(EnvVarPrefix, cmd)
},
SilenceUsage: true,
SilenceErrors: true,
}
cmd.AddCommand(NewRunCommand(streams))
// TODO: wrap help func for the root command and every subcommand to add a line about automatic env vars and the prefix.
cmdutil.InstallKlog(cmd)
utilfeature.DefaultMutableFeatureGate.AddFlag(cmd.PersistentFlags())
return cmd
}