/
testHA.go
50 lines (43 loc) · 1.08 KB
/
testHA.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
42
43
44
45
46
47
48
49
50
package main
import (
"errors"
"github.com/spf13/cobra"
"github.com/chef/automate/components/automate-cli/pkg/docs"
"github.com/chef/automate/components/automate-cli/pkg/status"
)
var testHAHelpDocs = `
Usage:
chef-automate test
run smoke tests manually.
`
var testCommandFlags = struct {
full bool
}{}
var testCmd = &cobra.Command{
Use: "test",
Short: "Run Automate HA smoke tests",
Long: "Run smoke test for Automate HA services.",
Args: cobra.RangeArgs(0, 1),
RunE: runTestCmd,
Annotations: map[string]string{
docs.Compatibility: docs.CompatiblewithHA,
},
}
func runTestCmd(cmd *cobra.Command, args []string) error {
if isA2HARBFileExist() {
if testCommandFlags.full {
args = append(args, "--full")
}
return executeAutomateClusterCtlCommandAsync("test", args, testHAHelpDocs, false)
} else {
return status.Wrap(errors.New(AUTOMATE_HA_INVALID_BASTION), status.ConfigError, testHAHelpDocs)
}
}
func init() {
testCmd.PersistentFlags().BoolVar(
&testCommandFlags.full,
"full",
false,
"Automate ha cluster test full")
RootCmd.AddCommand(testCmd)
}