github.com/wunderio/silta-cli@v0.0.0-20240508100559-3017e4ab3a20/tests/cloud_test.go (about) 1 package cmd_test 2 3 import ( 4 "os" 5 "testing" 6 ) 7 8 func TestCloudLoginCmd(t *testing.T) { 9 10 // Go to main directory 11 wd, _ := os.Getwd() 12 os.Chdir("..") 13 14 // Custom kubeconfig 15 command := "cloud login --kubeconfig `echo \"TEST\" | base64` --kubeconfigpath tmpkubeconfig --debug; cat tmpkubeconfig; rm tmpkubeconfig" 16 environment := []string{} 17 testString := "TEST\n" 18 CliExecTest(t, command, environment, testString, true) 19 20 // Custom kubeconfig as env variable 21 command = "cloud login --kubeconfigpath tmpkubeconfig --debug; cat tmpkubeconfig; rm tmpkubeconfig" 22 environment = []string{ 23 // echo "TEST2" | base64 => "VEVTVDIK" 24 "KUBECTL_CONFIG=VEVTVDIK", 25 } 26 testString = "TEST2\n" 27 CliExecTest(t, command, environment, testString, true) 28 29 // TODO: test gcp, aws and aks 30 t.Log("TODO: test gcp, aws and aks") 31 32 // Change dir back to previous 33 os.Chdir(wd) 34 }