airshipctl/cmd/cluster/cluster_test.go
Kostiantyn Kalynovskyi e1bc8ee07d [AIR-97] Adding initinfra subcommand
Command will deploy initial inftrastructure that is identified by
airshipctl document module, bundle interface, documents will be fitered
based on label and annotation, which will indicate that it belongs to
initial infrastructure.

After the documents are identified, they will be labeled
indicating that these resources are deployed by initinfra, if flag
`prune` is specified, resources that have initinfra annotation and
deployedBy initinfra label, but are not part of the documents supplied
by bundle interface will be deleted. If user wants to avoid pruning of
some resources he can remove label deployBy manually from the kubernetes
resources that should not prunned.

Change-Id: I143835291d449be420bfcb2944ba7eaec37c3411
2020-02-27 08:38:51 -06:00

33 lines
833 B
Go

package cluster_test
import (
"testing"
"opendev.org/airship/airshipctl/cmd/cluster"
"opendev.org/airship/airshipctl/pkg/environment"
"opendev.org/airship/airshipctl/testutil"
)
func TestNewClusterCommandReturn(t *testing.T) {
fakeRootSettings := &environment.AirshipCTLSettings{}
fakeRootSettings.SetAirshipConfigPath("../../testdata/k8s/config.yaml")
fakeRootSettings.SetKubeConfigPath("../../testdata/k8s/kubeconfig.yaml")
fakeRootSettings.InitConfig()
tests := []*testutil.CmdTest{
{
Name: "cluster-cmd-with-defaults",
CmdLine: "",
Cmd: cluster.NewClusterCommand(fakeRootSettings),
},
{
Name: "cluster-initinfra-cmd-with-defaults",
CmdLine: "--help",
Cmd: cluster.NewCmdInitInfra(fakeRootSettings),
},
}
for _, testcase := range tests {
testutil.RunTest(t, testcase)
}
}