diff --git a/config.json b/config.json new file mode 100644 index 0000000..0cb8c39 --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ +"ClusterDir": "/Users/alexeitighineanu/go/src/github.com/fgerling/bdd-poc/imba-cluster" +} diff --git a/features/cilium/cilium-01.feature b/features/cilium/cilium-01.feature new file mode 100644 index 0000000..1fc58e2 --- /dev/null +++ b/features/cilium/cilium-01.feature @@ -0,0 +1,94 @@ +# doc1: https://gitlab.suse.de/mkravec/scripts/blob/master/tests/cilium.sh +# doc2: http://docs.cilium.io/en/v1.6/gettingstarted/http/ +# TC: https://github.com/fgerling/bdd-poc +# This is a basic test for cilium (no PR or BSC provided) + +Feature: cilium-basic + + Scenario: Test-Cilium-Basic on Skuba Cluster + Given "skuba" exist in gopath + And VARIABLE "work-folder" I get from CONFIG + When I run "skuba cluster status" in VAR:"work-folder" directory + Then the output contains "master" and "worker" + When I run "kubectl get all --namespace=kube-system" + Then the output contains "cilium" and "dex" + + Scenario: Deploy the starwars cilium pods + When I run "kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.6/examples/minikube/http-sw-app.yaml" + And wait "10 seconds" + When I run "kubectl get pods --selector=org=empire" + Then the output contains "deathstar" and "tiefighter" + When I run "kubectl get pods --selector=org=alliance" + Then the output contains "xwing" + + Scenario: Check the starwars cilium pods + When I run "kubectl get pods" + And grep for "xwing" + Then the output contains "running" + And grep for "deathstar" + Then the output contains "running" + And grep for "tiefighter" + Then the output contains "running" + + Scenario: Test number1 if empire's ship is allowed into empire space + And I run "kubectl exec tiefighter -- curl -sm10 -XPOST deathstar.default.svc.cluster.local/v1/request-landing" + And wait "5 seconds" + Then the output contains "ship" and "landed" + + When I run "kubectl exec xwing -- curl -sm10 -XPOST deathstar.default.svc.cluster.local/v1/request-landing" + And wait "5 seconds" + Then the output contains "ship" and "landed" + + Scenario: Test number2 if policies work properly + When I run "kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.6/examples/minikube/sw_l3_l4_policy.yaml" + And I run "kubectl exec tiefighter -- curl -sm10 -XPOST deathstar.default.svc.cluster.local/v1/request-landing" + Then the output contains "ship" and "landed" + + When I run "kubectl exec xwing -- curl -sm10 -XPOST deathstar.default.svc.cluster.local/v1/request-landing" expecting ERROR + And wait "10 seconds" + Then the error contains "exit" and "28" + + Scenario: Inspecting the policies + When I run "kubectl -n kube-system get pods -l k8s-app=cilium" + Then the output contains "cilium-" and "running" + When VARIABLE "cilium-container" equals ContainerFROMOutput "cilium" + And VARIABLE "command5" equals "kubectl -n kube-system exec " plus VAR:"cilium-container" plus " -- cilium endpoint list" + And I run VAR:"command5" + And grep for "class=deathstar" + Then the output contains "enabled" and "disabled" + And I run VAR:"command5" + And grep for "class=xwing" + Then the output contains "disabled" and "disabled" + And I run VAR:"command5" + And grep for "class=tiefighter" + Then the output contains "disabled" and "disabled" + And I run "kubectl get cnp" + When VARIABLE "cilium-rule" equals ContainerFROMOutput "rule" + And VARIABLE "command6" equals "kubectl describe cnp " plus VAR:"cilium-rule" + And grep for "Class:" + Then the output contains "deathstar" and "deathstar" + And grep for "Org:" + Then the output contains "empire" and "empire" + And grep for "Description:" + Then the output contains "policy to restrict" and "empire ships only" + + Scenario: Applying new policy for exhaust port + When I run "kubectl apply -f https://raw.githubusercontent.com/cilium/cilium/v1.6/examples/minikube/sw_l3_l4_l7_policy.yaml" + Then the output contains "ciliumnetworkpolicy" and "configured" + And wait "1 seconds" + #When I run "kubectl exec tiefighter -- curl -s -XPOST deathstar.default.svc.cluster.local/v1/request-landing" + #Then the output contains "Ship" and "landed" + #When I run "kubectl exec tiefighter -- curl -s -XPOST deathstar.default.svc.cluster.local/v1/exhaust-port" + #Then the output contains "Access" and "denied" + + + Scenario: Deleting the policies + When I run "kubectl delete -f https://raw.githubusercontent.com/cilium/cilium/v1.6/examples/minikube/sw_l3_l4_l7_policy.yaml" + Then the output contains "ciliumnetworkpolicy" and "deleted" + + Scenario: Deleting the pods + When VARIABLE "work-folder" I get from CONFIG + When I run "kubectl delete -f https://raw.githubusercontent.com/cilium/cilium/v1.6/examples/minikube/http-sw-app.yaml" + Then the output contains "deathstar" and "deleted" + Then the output contains "xwing" and "deleted" + Then the output contains "tiefighter" and "deleted" \ No newline at end of file diff --git a/features/cilium/cilium-bsc#1121353.feature b/features/cilium/cilium-bsc#1121353.feature new file mode 100644 index 0000000..66cee92 --- /dev/null +++ b/features/cilium/cilium-bsc#1121353.feature @@ -0,0 +1,28 @@ +#TC description: https://github.com/SUSE/caasp-test-cases/pull/22/files#diff-6b705e1a52bb5b33c1c2efee4a329c2f +#BUG: https://bugzilla.suse.com/show_bug.cgi?id=1121353 +#PR: https://github.com/SUSE/skuba/pull/967 + +Feature: bsc#1121353 - Kubernetes – Master node pod configured with Privileged PSP + +Scenario: Checking if Privileged Pods + Given "skuba" exist in gopath + And VARIABLE "work-folder" I get from CONFIG + When I run "skuba cluster status" in VAR:"work-folder" directory + Then the output contains "master" and "worker" + When I run "kubectl get all --namespace=kube-system" + Then the output contains "cilium" and "dex" + + When I run "kubectl get pods --namespace=kube-system" + When VARIABLE "privileged-pods" equals ContainersFROMOutput "cilium-" + And VARIABLES "commandchecks" equals "kubectl describe pod -n kube-system " plus VAR:"privileged-pods" + And I run VARS:"commandchecks" and check for "psp" and "kubernetes.io/psp: suse.caasp.psp.privileged" + + When I run "kubectl get pods --namespace=kube-system" + When VARIABLE "privileged-pods" equals ContainersFROMOutput "kube-proxy-" + And VARIABLES "commandchecks" equals "kubectl describe pod -n kube-system " plus VAR:"privileged-pods" + And I run VARS:"commandchecks" and check for "psp" and "kubernetes.io/psp: suse.caasp.psp.privileged" + + When I run "kubectl get pods --namespace=kube-system" + When VARIABLE "privileged-pods" equals ContainersFROMOutput "kured-" + And VARIABLES "commandchecks" equals "kubectl describe pod -n kube-system " plus VAR:"privileged-pods" + And I run VARS:"commandchecks" and check for "psp" and "kubernetes.io/psp: suse.caasp.psp.privileged" diff --git a/features/cluster/status.feature b/features/cluster/status.feature index 1bc6577..beec075 100644 --- a/features/cluster/status.feature +++ b/features/cluster/status.feature @@ -3,8 +3,8 @@ Feature: Skuba cluster status Scenario: checkout cluster status - Given there is "cluster" directory + Given VARIABLE "cluster" I get from CONFIG And "skuba" exist in gopath - When I run "skuba cluster status" in "cluster" directory + When I run "skuba cluster status" in VAR:"cluster" directory Then the output contains "master" And the output contains "worker" diff --git a/features/kured/kured-01.feature b/features/kured/kured-01.feature new file mode 100644 index 0000000..af56ab4 --- /dev/null +++ b/features/kured/kured-01.feature @@ -0,0 +1,26 @@ +# TC: https://github.com/fgerling/bdd-poc +# This is a basic test for kured (no PR or BSC provided) + +Feature: Check if reboot triggered + +Scenario: Checking if reboot triggered on one node + Given "skuba" exist in gopath + And VARIABLE "imba-cluster" I get from CONFIG + When I run "skuba cluster status" in VAR:"imba-cluster" directory + Then the output contains "master" and "worker" + When I run "kubectl get all --namespace=kube-system" + Then the output contains "cilium" and "dex" + + When I run "kubectl get daemonset kured -o yaml -n kube-system" + And I insert in OUTPUT "- --period=30s" and save it to kurednew.yaml + And I run "kubectl apply -f kurednew.yaml" + Then the output contains "configured" + And wait "30 seconds" + When I run "kubectl get pods --namespace=kube-system" + When VARIABLE "privileged-pods" equals ContainersFROMOutput "kured-" + And VARIABLES "commandchecks" equals "kubectl describe pod -n kube-system " plus VAR:"privileged-pods" + And I run VARS:"commandchecks" and IPSFromOutput + And I run SSHCMD "sudo touch /var/run/reboot-required" on MASTER + And wait "140 seconds" + And I run SSHCMD "sudo crictl ps" on MASTER + Then the output contains "seconds" or "a minute" \ No newline at end of file diff --git a/features/skuba_upgrade/skuba_upgrade-01.feature b/features/skuba_upgrade/skuba_upgrade-01.feature new file mode 100644 index 0000000..20929de --- /dev/null +++ b/features/skuba_upgrade/skuba_upgrade-01.feature @@ -0,0 +1,93 @@ +# TC: https://github.com/SUSE/caasp-test-cases +# PR: https://github.com/SUSE/skuba/pull/911 +# FEATURE: skuba cluster upgrade + +# You are expected to run this test on a cluster bootstrapped with kubernetes-1.15.2 +Feature: Check if cluster upgrade is fine + +Scenario: Checking if cluster exists + Given "skuba" exist in gopath + And VARIABLE "imba-cluster" I get from CONFIG + When I run "skuba cluster status" in VAR:"imba-cluster" directory + Then the output contains "master" and "worker" + Then the output contains "1.15.2" + When I run "kubectl get all --namespace=kube-system" + Then the output contains "cilium" and "dex" + When I run "skuba version" + Then the output contains "v1.0.2" or "v1.1.2" + + When I run "skuba cluster upgrade plan" in VAR:"imba-cluster" directory + Then the output contains "current kubernetes" and "latest kubernetes" + #Then the output contains "upgrade path to update" + #Then the output contains "addon upgrades from" + +<<<<<<< HEAD + When I run "skuba addon upgrade apply" expecting ERROR:"unknown addon" in VAR:"imba-cluster" directory + Then the error contains "metrics" and " " + Then the output contains "congratulations" or "not all" or "successfully" +======= + When I run "zypper -n in skuba-1.2.1" + Then the output contains "installed" + + When I run "skuba cluster upgrade plan" in VAR:"imba-cluster" directory + Then the output contains "current kubernetes" and "latest kubernetes" + #Then the output contains "upgrade path to update" + #Then the output contains "addon upgrades from" + + When I run "skuba addon upgrade apply" in VAR:"imba-cluster" directory + Then the output contains "congratulations" or "ot all" +>>>>>>> 0ea92486ed0ea35bac64f5ebea1989dd4b9f4019 + +Scenario: Applying upgrade on nodes + When I run "kubectl get pods --namespace=kube-system" + And VARIABLE "imba-cluster" I get from CONFIG + When VARIABLE "privileged-pods" equals ContainersFROMOutput "kured-" + And VARIABLES "commandchecks" equals "kubectl describe pod -n kube-system " plus VAR:"privileged-pods" + And I run VARS:"commandchecks" and IPSFromOutput + + #UPGRADING MASTERS FIRST + When VARIABLES "commandupgrades" equals "skuba node upgrade plan " plus Master Nodes + And I run UPGRADE VARS:"commandupgrades" in VAR:"imba-cluster" directory + Then the output contains "apiserver" and "controller-manager" and "scheduler" + And the output contains "etcd" and "kubelet" and "cri-o" + And I run UPGRADE VARS:"commandupgrades" in VAR:"imba-cluster" directory + Then the output contains "apiserver" and "controller-manager" and "scheduler" + And the output contains "etcd" and "kubelet" and "cri-o" + And I run UPGRADE VARS:"commandupgrades" in VAR:"imba-cluster" directory + Then the output contains "apiserver" and "controller-manager" and "scheduler" + And the output contains "etcd" and "kubelet" and "cri-o" + + When VARIABLES "upgradeapply" equals "skuba node upgrade apply --user sles --sudo --target " plus Master Node IPS + And I run UPGRADE VARS:"upgradeapply" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + And wait "120 seconds" + And I run UPGRADE VARS:"upgradeapply" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + And wait "120 seconds" + And I run UPGRADE VARS:"upgradeapply" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + And wait "120 seconds" + + +# UPGRADING THEN WORKERS + #Scenario: Upgrading Workers + When VARIABLES "commandupgrades2" equals "skuba node upgrade plan " plus Worker Nodes + And VARIABLE "imba-cluster" I get from CONFIG + And I run UPGRADE VARS:"commandupgrades2" in VAR:"imba-cluster" directory + Then the output contains "kubelet" and "cri-o" + And I run UPGRADE VARS:"commandupgrades2" in VAR:"imba-cluster" directory + Then the output contains "kubelet" and "cri-o" + + When VARIABLES "upgradeapply2" equals "skuba node upgrade apply --user sles --sudo --target " plus Worker Node IPS + And I run UPGRADE VARS:"upgradeapply2" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + + When I run "skuba addon upgrade apply" expecting ERROR:"unknown addon" in VAR:"imba-cluster" directory + Then the output contains "not all nodes" or "successfully" or "congratulations" + + When VARIABLES "upgradeapply3" equals "skuba node upgrade apply --user sles --sudo --target " plus Worker Node IPS + And I run UPGRADE VARS:"upgradeapply3" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + + When I run "skuba addon upgrade apply" expecting ERROR:"unknown addon" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "congratulations" or "not all nodes" diff --git a/features/skuba_upgrade/skuba_upgrade-02.feature b/features/skuba_upgrade/skuba_upgrade-02.feature new file mode 100644 index 0000000..2d7889f --- /dev/null +++ b/features/skuba_upgrade/skuba_upgrade-02.feature @@ -0,0 +1,86 @@ +# TC: https://github.com/SUSE/caasp-test-cases +# PR: https://github.com/SUSE/skuba/pull/911 +# FEATURE: skuba cluster upgrade + +# You are expected to run this test on a cluster bootstrapped with kubernetes-1.16.2 +Feature: Check if cluster upgrade is fine + +Scenario: Checking if cluster exists + Given "skuba" exist in gopath + And VARIABLE "imba-cluster" I get from CONFIG + When I run "skuba cluster status" in VAR:"imba-cluster" directory + Then the output contains "master" and "worker" + Then the output contains "1.16.2" + When I run "kubectl get all --namespace=kube-system" + Then the output contains "cilium" and "dex" + When I run "skuba version" + Then the output contains "v1.2.4" or "v1.3.1" or "1.2.9" + + When I run "skuba cluster upgrade plan" in VAR:"imba-cluster" directory + Then the output contains "current kubernetes" and "latest kubernetes" + #Then the output contains "upgrade path to update" + #Then the output contains "addon upgrades from" + + When I run "zypper -n in skuba-1.3.1" + Then the output contains "installed" + + When I run "skuba cluster upgrade plan" in VAR:"imba-cluster" directory + Then the output contains "current kubernetes" and "latest kubernetes" + #Then the output contains "upgrade path to update" + #Then the output contains "addon upgrades from" + + When I run "skuba addon upgrade apply" in VAR:"imba-cluster" directory + Then the output contains "congratulations" or "ot all" + +Scenario: Applying upgrade on nodes + When I run "kubectl get pods --namespace=kube-system" + And VARIABLE "imba-cluster" I get from CONFIG + When VARIABLE "privileged-pods" equals ContainersFROMOutput "kured-" + And VARIABLES "commandchecks" equals "kubectl describe pod -n kube-system " plus VAR:"privileged-pods" + And I run VARS:"commandchecks" and IPSFromOutput + + #UPGRADING MASTERS FIRST + When VARIABLES "commandupgrades" equals "skuba node upgrade plan " plus Master Nodes + And I run UPGRADE VARS:"commandupgrades" in VAR:"imba-cluster" directory + Then the output contains "apiserver" and "controller-manager" and "scheduler" + And the output contains "etcd" and "kubelet" and "cri-o" + And I run UPGRADE VARS:"commandupgrades" in VAR:"imba-cluster" directory + Then the output contains "apiserver" and "controller-manager" and "scheduler" + And the output contains "etcd" and "kubelet" and "cri-o" + And I run UPGRADE VARS:"commandupgrades" in VAR:"imba-cluster" directory + Then the output contains "apiserver" and "controller-manager" and "scheduler" + And the output contains "etcd" and "kubelet" and "cri-o" + + When VARIABLES "upgradeapply" equals "skuba node upgrade apply --user sles --sudo --target " plus Master Node IPS + And I run UPGRADE VARS:"upgradeapply" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + And wait "120 seconds" + And I run UPGRADE VARS:"upgradeapply" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + And wait "120 seconds" + And I run UPGRADE VARS:"upgradeapply" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + And wait "120 seconds" + +# UPGRADING THEN WORKERS + #Scenario: Upgrading Workers + When VARIABLES "commandupgrades2" equals "skuba node upgrade plan " plus Worker Nodes + And VARIABLE "imba-cluster" I get from CONFIG + And I run UPGRADE VARS:"commandupgrades2" in VAR:"imba-cluster" directory + Then the output contains "kubelet" and "cri-o" + And I run UPGRADE VARS:"commandupgrades2" in VAR:"imba-cluster" directory + Then the output contains "kubelet" and "cri-o" + + When VARIABLES "upgradeapply2" equals "skuba node upgrade apply --user sles --sudo --target " plus Worker Node IPS + And I run UPGRADE VARS:"upgradeapply2" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + + When I run "skuba addon upgrade apply" in VAR:"imba-cluster" directory + Then the output contains "not all nodes" or "successfully" or "congratulations" + + When VARIABLES "upgradeapply3" equals "skuba node upgrade apply --user sles --sudo --target " plus Worker Node IPS + And I run UPGRADE VARS:"upgradeapply3" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "to date" or "there are addon upgrades available" + + When I run "skuba addon upgrade apply" in VAR:"imba-cluster" directory + Then the output contains "successfully" or "congratulations" diff --git a/features/skuba_upgrade/skuba_upgrade-bsc#1167320.feature b/features/skuba_upgrade/skuba_upgrade-bsc#1167320.feature new file mode 100644 index 0000000..45be7d6 --- /dev/null +++ b/features/skuba_upgrade/skuba_upgrade-bsc#1167320.feature @@ -0,0 +1,31 @@ +# TC: https://github.com/SUSE/caasp-test/features/skuba_upgrade/skuba_upgrade_bsc#1167320.feature +# PR: https://github.com/SUSE/skuba/pull/1018 +# BSC: https://bugzilla.suse.com/show_bug.cgi?id=1167320 +# FEATURE: skuba addon upgrade + +# You are expected to run this test on a cluster bootstrapped with kubernetes-1.15.2 +Feature: Check if cluster upgrade is fine + +Scenario: Checking if cluster exists + Given "skuba" exist in gopath + And VARIABLE "imba-cluster" I get from CONFIG + When I run "skuba cluster status" in VAR:"imba-cluster" directory + Then the output contains "master" and "worker" + Then the output contains "1.15.2" + When I run "kubectl get all --namespace=kube-system" + Then the output contains "cilium" and "dex" + When I run "skuba version" + Then the output contains "v1.2.6" or "v1.2.7" + + When I run "skuba addon upgrade plan" in VAR:"imba-cluster" directory + Then the output contains "congratulations" or "are already" + + When I run "kubectl get configmaps skuba-config -n kube-system -o yaml" in VAR:"imba-cluster" directory + And I replace Cilium Version in OUTPUT and save it into skubaconf.yaml file + + When I run "cat skubaconf.yaml" + And I replace Gangway Version in OUTPUT and save it into skubaconf.yaml file + And I run "kubectl apply -f skubaconf.yaml" + And I run "skuba addon upgrade plan" in VAR:"imba-cluster" directory + Then the output contains "cilium" and "gangway" + Then the output contains "->" and "1.5.1" and "2.1.0-rev4" diff --git a/features/status.feature b/features/status.feature new file mode 100644 index 0000000..b34ef3e --- /dev/null +++ b/features/status.feature @@ -0,0 +1,10 @@ +# doc: https://github.com/SUSE/skuba/blob/master/README.md + +Feature: Skuba cluster status + + Scenario: checkout cluster status + Given there is "imba-cluster" directory + And "skuba" exist in gopath + When I run "skuba cluster status" in "imba-cluster" directory + Then the output contains "master" + And the output contains "worker" \ No newline at end of file diff --git a/internal/cilium.go b/internal/cilium.go new file mode 100644 index 0000000..2977a06 --- /dev/null +++ b/internal/cilium.go @@ -0,0 +1,90 @@ +package features + +import ( + "fmt" + "strconv" + "strings" +) + +func (test *TestRun) VARIABLEEqualsContainersFROMOutput(arg1, arg2 string) error { + var err error + tmp := strings.Split(fmt.Sprintf("%s", string(test.Output)), "\n") + for index, elem := range tmp { + if strings.Contains(elem, arg2) && !strings.Contains(elem, "operator") { //--- "operator" is to exclude cilium-operator + tmp2 := strings.Split(elem, " ") + err = test.VARIABLEEquals(arg1+strconv.Itoa(index), tmp2[0]) + } + } + return err +} + +func (test *TestRun) VARIABLEEqualsContainerFROMOutput(arg1, arg2 string) error { + var err error + tmp := strings.Split(fmt.Sprintf("%s", string(test.Output)), "\n") + for _, elem := range tmp { + if strings.Contains(elem, arg2) { + tmp2 := strings.Split(elem, " ") + err = test.VARIABLEEquals(arg1, tmp2[0]) + break + } + } + return err +} + +func (test *TestRun) VARIABLEEquals(arg1, arg2 string) error { + if test.VarMap == nil { + test.VarMap = make(map[string]string) + } + test.VarMap[arg1] = arg2 + fmt.Printf(" VAR: %s = %s \n", arg1, test.VarMap[arg1]) + return nil +} + +func (test *TestRun) VARIABLEEqualsPlusVARPlus(arg1, arg2, arg3, arg4 string) error { + arg3 = test.VarMap[arg3] + tmp := arg2 + arg3 + arg4 + err := test.VARIABLEEquals(arg1, tmp) + return err +} + +func (test *TestRun) VARIABLESEqualsPlusVAR(arg1, arg2, arg3 string) error { + var err error + for i := 0; i < 1000; i++ { + if test.VarMap[arg3+strconv.Itoa(i)] != "" { + tmp := arg2 + test.VarMap[arg3+strconv.Itoa(i)] + err = test.VARIABLEEquals(arg1+strconv.Itoa(i), tmp) + if err == nil { + test.VarMap[arg3+strconv.Itoa(i)] = "" + } + } + + } + return err +} + +func (test *TestRun) VARIABLEEqualsPlusVAR(arg1, arg2, arg3 string) error { + arg3 = test.VarMap[arg3] + tmp := arg2 + arg3 + err := test.VARIABLEEquals(arg1, tmp) + return err +} + +func (test *TestRun) TheErrorContainsAnd(arg1, arg2 string) error { + var err error + if !strings.Contains(fmt.Sprintf("%s", test.Err), arg1) && strings.Contains(fmt.Sprintf("%s", test.Err), arg2) { + fmt.Println("ERROR!!!") + } + return err +} + +func (test *TestRun) IRunVARSAndCheckForAnd(arg1, arg2, arg3 string) error { + var err error + for i := 0; i < 1000; i++ { + if test.VarMap[arg1+strconv.Itoa(i)] != "" { + err = test.IRunInDirectory(test.VarMap[arg1+strconv.Itoa(i)], ".") + test.TheOutputContainsAnd(arg2, arg3) + test.VarMap[arg1+strconv.Itoa(i)] = "" + } + } + return err +} diff --git a/internal/data.go b/internal/data.go new file mode 100644 index 0000000..3de7d9e --- /dev/null +++ b/internal/data.go @@ -0,0 +1,19 @@ +package features + +type TestRun struct { + Output []byte + VarMap map[string]string + UpgradeCheck map[string]NodeCheck + Err error + Config Config +} + +type NodeCheck struct { + PlanDone bool + UPDone bool + IP string +} + +type Config struct { + ClusterDir string `json:"ClusterDir"` +} diff --git a/internal/kured.go b/internal/kured.go new file mode 100644 index 0000000..5937d2f --- /dev/null +++ b/internal/kured.go @@ -0,0 +1,100 @@ +package features + +import ( + "fmt" + "log" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" +) + +func (test *TestRun) IRunInDirectory(arg1, arg2 string) error { + var err error + tmp := strings.Split(arg1, " ") + cmd := exec.Command(tmp[0], tmp[1:]...) + cmd.Dir = arg2 + //fmt.Printf("RUN: %s in %s\n", arg1, arg2) + output, err := cmd.CombinedOutput() + if err != nil { + fmt.Fprintf(os.Stdout, "error: %s", err) + } + test.Output = output + test.Err = err + //fmt.Printf("%s", fmt.Sprintf("%s", string(test.Output))) + return err +} + +func (test *TestRun) IRunVARSAndIPSFromOutput(arg1 string) error { + var err error + for i := 0; i < 1000; i++ { + if test.VarMap[arg1+strconv.Itoa(i)] != "" { + err = test.IRunInDirectory(test.VarMap[arg1+strconv.Itoa(i)], ".") + tmp1 := strings.Split(fmt.Sprintf("%s", string(test.Output)), "\n") + for _, elem := range tmp1 { + if strings.Contains(elem, "Node:") { + tmp2 := strings.Split(strings.Split(strings.Replace(elem, " ", "", 100), ":")[len(strings.Split(strings.Replace(elem, " ", "", 100), ":"))-1], "/") + if len(tmp2) == 2 { + test.VARIABLEEquals(tmp2[0], tmp2[1]) + } else { + fmt.Printf("Something's wrong with your kubectl describe...\n Is that even the right row? %s\n", elem) + } + break + } + } + test.VarMap[arg1+strconv.Itoa(i)] = "" + } + } + return err +} + +func (test *TestRun) IRunSSHCMDOnMASTER(arg1 string) error { + var ip string + for key, _ := range test.VarMap { + if test.VarMap["master-marked"] == "" { + if strings.Contains(key, "master") /*&& strings.Contains(key, "00")*/ { + ip = test.VarMap[key] + test.VarMap["master-marked"] = ip + } + } else { + ip = test.VarMap["master-marked"] + } + } + dir, _ := os.Getwd() + arg := append( + []string{"-q", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile /dev/null", "-i", filepath.Join(dir, "id_shared"), + fmt.Sprintf("sles@%s", ip), + }, + arg1, + ) + cmd := exec.Command("ssh", arg...) + cmd.Env = os.Environ() + output, err := cmd.CombinedOutput() + if err != nil { + log.Printf("Error! %s", err) + } + test.Output = output + //fmt.Printf("%s\n", fmt.Sprintf("%s", string(test.Output))) + return err +} + +func (test *TestRun) IInsertInOUTPUTAndSaveItToKurednewyaml(arg1 string) error { + var kurednewouput string + for index, row := range strings.Split(fmt.Sprintf("%s", string(test.Output)), "\n") { + kurednewouput += row + "\n" + if strings.Contains(row, "- /usr/bin/kured") && strings.Contains(strings.Split(fmt.Sprintf("%s", string(test.Output)), "\n")[index-1], "- command:") { + kurednewouput += strings.Replace(row, "- /usr/bin/kured", "- --period=30s\n", 1) + } + } + f, err := os.Create("kurednew.yaml") + if err != nil { + test.TreatErrors(err) + } + _, err = f.WriteString(kurednewouput) + if err != nil { + test.TreatErrors(err) + } + f.Close() + return err +} diff --git a/internal/skuba_upgrade.go b/internal/skuba_upgrade.go new file mode 100644 index 0000000..b970be8 --- /dev/null +++ b/internal/skuba_upgrade.go @@ -0,0 +1,152 @@ +package features + +import ( + "fmt" + "os" + "os/exec" + "strings" + "time" + "log" +) + +func (test *TestRun) VARIABLESEqualsPlusMasterNodes(arg1, arg2 string) error { + var temp1 NodeCheck + if test.UpgradeCheck == nil { + test.UpgradeCheck = make(map[string]NodeCheck) + } + for key, _ := range test.VarMap { + if strings.Contains(key, "master") && !strings.Contains(key, arg1) && test.UpgradeCheck[key].IP == "" { + test.VarMap[arg1+key] = arg2 + key + fmt.Printf("VAR: %s = %s\n", arg1+key, arg2+key) + temp1.IP = test.VarMap[key] + temp1.PlanDone = false + temp1.UPDone = false + test.UpgradeCheck[key] = temp1 + } + } + return nil +} + +func (test *TestRun) VARIABLESEqualsPlusWorkerNodes(arg1, arg2 string) error { + var temp1 NodeCheck + if test.UpgradeCheck == nil { + test.UpgradeCheck = make(map[string]NodeCheck) + } + for key, _ := range test.VarMap { + if strings.Contains(key, "worker") && !strings.Contains(key, arg1) && test.UpgradeCheck[key].IP == "" { + test.VarMap[arg1+key] = arg2 + key + fmt.Printf("VAR: %s = %s\n", arg1+key, arg2+key) + temp1.IP = test.VarMap[key] + temp1.PlanDone = false + temp1.UPDone = false + test.UpgradeCheck[key] = temp1 + } + } + return nil +} + +func (test *TestRun) VARIABLESEqualsPlusMasterNodeIPS(arg1, arg2 string) error { + for key, _ := range test.VarMap { + if strings.Contains(key, "master") && !strings.Contains(test.VarMap[key], "plan") && !strings.Contains(key, arg1) { + test.VarMap[arg1+key] = arg2 + test.UpgradeCheck[key].IP + fmt.Printf("VAR: %s = %s\n", arg1+key, test.VarMap[arg1+key]) + } + } + return nil +} + +func (test *TestRun) VARIABLESEqualsPlusWorkerNodeIPS(arg1, arg2 string) error { + for key, _ := range test.VarMap { + if strings.Contains(key, "worker") && !strings.Contains(test.VarMap[key], "plan") && !strings.Contains(key, arg1) { + test.VarMap[arg1+key] = arg2 + test.UpgradeCheck[key].IP + fmt.Printf("VAR: %s = %s\n", arg1+key, test.VarMap[arg1+key]) + } + } + return nil +} + +func (test *TestRun) CheckKubernetesAPI() (bool, error) { +cmdargs := []string{"kubectl", "get", "all", "-n", "kube-system"} +cmd := exec.Command(cmdargs[0], cmdargs[1:]...) +cmd.Dir = test.Config.ClusterDir +output, err := cmd.CombinedOutput() +if err != nil { +log.Printf("Error: %s\n", err) +} +return strings.Contains(fmt.Sprintf("%s", string(output)), "kured"), err +} + +func (test *TestRun) IRunUPGRADEVARSInVARDirectory(arg1, arg2 string) error { + var err error + for key, _ := range test.VarMap { + if strings.Contains(key, arg1) && test.UpgradeCheck[key].PlanDone == false { + for { + log.Println("Waiting for k8s API to come back up...") + trigger,_ := test.CheckKubernetesAPI() + if trigger { + break + } + time.Sleep(5 * time.Second) + } + //fmt.Printf("Command we run: %s\n", test.VarMap[key]) + test.Output = []byte{1} + err = test.IRunInDirectory(test.VarMap[key], test.VarMap[arg2]) + if err != nil { + test.TreatErrors(err) + } + temp1 := test.UpgradeCheck[key] + temp1.PlanDone = true + if strings.Contains(test.VarMap[key], "apply") { + temp1.UPDone = true + } + test.UpgradeCheck[key] = temp1 + fmt.Println(fmt.Sprintf("%s", string(test.Output))) + break + } + } + return err +} + +func (test *TestRun) IReplaceCiliumVersionInOUTPUTAndSaveItIntoSkubaconfyamlFile() error { + template := fmt.Sprintf("%s", string(test.Output)) + for index, row := range strings.Split(template, "\n") { + if strings.Contains(strings.ToLower(row), "cilium") { + version := strings.Split(template, "\n")[index+2] + replace_version := strings.Split(version, ":")[0] + ": 1.5.1" + template = strings.Replace(template, version, replace_version, 1) + break + } + } + f, err := os.Create("skubaconf.yaml") + if err != nil { + test.TreatErrors(err) + } + _, err = f.WriteString(template) + if err != nil { + test.TreatErrors(err) + } + f.Close() + return err +} + +func (test *TestRun) IReplaceGangwayVersionInOUTPUTAndSaveItIntoSkubaconfyamlFile() error { + template := fmt.Sprintf("%s", string(test.Output)) + for index, row := range strings.Split(template, "\n") { + if strings.Contains(strings.ToLower(row), "gangway") { + version := strings.Split(template, "\n")[index+2] + replace_version := strings.Split(version, ":")[0] + ": 2.1.0-rev4" + template = strings.Replace(template, version, replace_version, 1) + break + } + } + f, err := os.Create("skubaconf.yaml") + if err != nil { + test.TreatErrors(err) + } + _, err = f.WriteString(template) + if err != nil { + test.TreatErrors(err) + } + f.Close() + return err +} diff --git a/internal/utilities.go b/internal/utilities.go new file mode 100644 index 0000000..8b75b1c --- /dev/null +++ b/internal/utilities.go @@ -0,0 +1,177 @@ +package features + +import ( + "encoding/json" + "errors" + "fmt" + "os" + "os/exec" + "strings" +) + +func (test *TestRun) IStartTest() error { + test.Output = []byte{1} + test.VarMap = make(map[string]string) + test.Err = nil + return nil +} + +func (test *TestRun) TheOutputContains(arg string) error { + if !strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg) { + return errors.New("Output does not contain expected argument") + } + return nil +} + +func (test *TestRun) TheOutputContainsAnd(arg1, arg2 string) error { + if !strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg1) && strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg2) { + return errors.New("Output does not contain expected arguments") + } + return nil +} + +func (test *TestRun) TheOutputContainsAndAnd(arg1, arg2, arg3 string) error { + if !strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg1) && strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg2) && strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg3) { + return errors.New("Output does not contain expected arguments") + } + return nil +} + +func (test *TestRun) TheOutputContainsOr(arg1, arg2 string) error { + //fmt.Printf("text:\n%s\nvars: %s %s\n ", strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg1, arg2) + if strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg1) || strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg2) { + } else { + return errors.New("Output does not contain expected arguments") + } + return nil +} + +func (test *TestRun) TheOutputContainsOrOr(arg1, arg2, arg3 string) error { + //fmt.Printf("text:\n%s\nvars: %s %s\n ", strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg1, arg2) + if strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg1) || strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg2) || strings.Contains(strings.ToLower(fmt.Sprintf("%s", string(test.Output))), arg3) { + } else { + return errors.New("Output does not contain expected arguments") + } + return nil +} + +func (test *TestRun) IRunVAR(arg1 string) error { + if test.VarMap["command5"] == "" { + return test.Irun(test.VarMap[arg1]) + } else { + return test.Irun(test.VarMap[arg1]) + } +} + +func (test *TestRun) IRunVARInVARDirectory(arg1, arg2 string) error { + arg1 = test.VarMap[arg1] + err := test.IRunInVARDirectory(arg1, arg2) + fmt.Println(fmt.Sprintf("%s", string(test.Output))) + return err +} + +func (test *TestRun) IRunInVARDirectory(arg1, arg2 string) error { + arg2 = test.VarMap[arg2] + err := test.IRunInDirectory(arg1, arg2) + fmt.Println(fmt.Sprintf("%s", string(test.Output))) + return err +} + +func (test *TestRun) Irun(command string) error { + return test.IRunInDirectory(command, ".") +} + +func (test *TestRun) GrepFor(arg1 string) error { + var err error + tmp := strings.Split(fmt.Sprintf("%s", string(test.Output)), "\n") + for _, elem := range tmp { + if strings.Contains(strings.ToLower(elem), arg1) { + test.Output = []byte(elem) + } + } + return err +} + +func (test *TestRun) TreatErrors(err error) { + if err != nil { + fmt.Fprintf(os.Stdout, "\nError: %v\n", err) + } +} + +func (test *TestRun) VARIABLEIGetFromCONFIG(arg1 string) error { + if test.VarMap == nil { + test.IStartTest() + } + var config Config + file, err := os.Open("config.json") + defer file.Close() + if err != nil { + test.TreatErrors(err) + } + if err := json.NewDecoder(file).Decode(&config); err != nil { + test.TreatErrors(err) + } + test.Config = config + test.VarMap[arg1] = config.ClusterDir + fmt.Printf("VAR: %s = %s", arg1, test.VarMap[arg1]) + return nil +} + +func (test *TestRun) IRunExpectingERRORInVARDirectory(arg1, arg2, arg3 string) error { + var err error + tmp := strings.Split(arg1, " ") + cmd := exec.Command(tmp[0], tmp[1:]...) + cmd.Dir = arg3 + output, err := cmd.CombinedOutput() + if err != nil { + fmt.Printf("ERROR: %v\n grep: %s", err, arg2) + fmt.Printf("OUTPUT: %s\n", fmt.Sprintf("%s", string(output))) + if !strings.Contains(fmt.Sprintf("%s", err), arg2) { + fmt.Fprintf(os.Stdout, "error: %s", err) + return nil + } + } else { + test.Err = err + } + test.Output = output + return nil +} + +func (test *TestRun) IRunVARExpectingERROR(arg1 string) error { + test.IRunExpectingERROR(test.VarMap[arg1]) + return nil +} + +func (test *TestRun) IRunVARExpectingERRORInVARDirectory(arg1, arg2 string) error { + var err error + tmp := strings.Split(test.VarMap[arg1], " ") + cmd := exec.Command(tmp[0], tmp[1:]...) + cmd.Dir = arg2 + output, err := cmd.CombinedOutput() + if err != nil { + if !strings.Contains(fmt.Sprintf("%s", err), "exit code") && strings.Contains(fmt.Sprintf("%s", err), "28") { + fmt.Fprintf(os.Stdout, "error: %s", err) + return err + } + } + test.Output = output + test.Err = err + return nil +} + +func (test *TestRun) IRunExpectingERROR(arg1 string) error { + var err error + tmp := strings.Split(arg1, " ") + cmd := exec.Command(tmp[0], tmp[1:]...) + output, err := cmd.CombinedOutput() + if err != nil { + if !strings.Contains(fmt.Sprintf("%s", err), "exit") && strings.Contains(fmt.Sprintf("%s", err), "28") { + fmt.Fprintf(os.Stdout, "error: %s", err) + return err + } + } + test.Output = output + test.Err = err + err = nil + return err +} diff --git a/main_test.go b/main_test.go index 9193114..79ebb04 100644 --- a/main_test.go +++ b/main_test.go @@ -1,19 +1,22 @@ package main import ( - "errors" "fmt" + "log" "os" - "os/exec" "path" + "strconv" "strings" + "time" + + . "github.com/fgerling/bdd-poc/internal" "github.com/cucumber/godog" suse "github.com/fgerling/bdd-poc/internal/suse" git "gopkg.in/src-d/go-git.v4" ) -var Output []byte +var test TestRun func existInGopath(arg1 string) error { return theFileExist(path.Join(os.Getenv("GOPATH"), "bin")) @@ -60,51 +63,96 @@ func thereIsNoDirectory(target string) error { return os.RemoveAll(target) } -func iRunInDirectory(command, workdir string) error { - var err error - args := strings.Split(command, " ") - cmd := exec.Command(args[0], args[1:]...) - cmd.Dir = workdir - Output, err = cmd.CombinedOutput() - if err != nil { - return errors.New(string(Output)) - } - return err -} - -func theOutputContains(arg string) error { - if !strings.Contains(fmt.Sprintf("%s", string(Output)), arg) { - return errors.New("Output does not contain expected argument") - } - return nil +func ReadStringAsInt(arg1 string) (int, error) { + a, err := strconv.Atoi(arg1) + return a, err } -func theOutputContainsAnd(arg1, arg2 string) error { - if !strings.Contains(fmt.Sprintf("%s", string(Output)), arg1) && strings.Contains(fmt.Sprintf("%s", string(Output)), arg2) { - return errors.New("Output does not contain expected arguments") +func wait(arg1 string) error { + var err error + temp := strings.Split(arg1, " ") + if len(temp) > 2 || len(temp) == 1 { + log.Println("Sorry... you've mistaken the format of time input (it's <1*EMPTYSPACE>") + return nil + } else { + switch temp[1] { + case "seconds": + a, err := ReadStringAsInt(temp[0]) + if err != nil { + log.Printf("Error: %v\n", err) + } + time.Sleep(time.Duration(a) * time.Second) + case "minutes": + a, err := ReadStringAsInt(temp[0]) + if err != nil { + log.Printf("Error: %v\n", err) + } + time.Sleep(time.Duration(a) * time.Minute) + case "hours": + a, err := ReadStringAsInt(temp[0]) + if err != nil { + log.Printf("Error: %v\n", err) + } + time.Sleep(time.Duration(a) * time.Hour) + } } - return nil + return err } func FeatureContext(s *godog.Suite) { + s.Step(`^I start test$`, test.IStartTest) + s.Step(`^wait "([^"]*)"$`, wait) + s.Step(`^VARIABLE "([^"]*)" I get from CONFIG$`, test.VARIABLEIGetFromCONFIG) s.Step(`^"([^"]*)" exist in gopath$`, existInGopath) s.Step(`^I git clone "([^"]*)" into "([^"]*)"$`, iGitCloneInto) s.Step(`^I have "([^"]*)" in PATH$`, suse.IHaveInPATH) - s.Step(`^I install the pattern "([^"]*)"$`, func() error { return iRunInDirectory("zypper -n in -t pattern SUSE-CaaSP-Management", ".") }) + s.Step(`^I install the pattern "([^"]*)"$`, func() error { return test.IRunInDirectory("zypper -n in -t pattern SUSE-CaaSP-Management", ".") }) s.Step(`^I remove "([^"]*)" from gopath$`, iRemoveFromGopath) - s.Step(`^I run "([^"]*)" in "([^"]*)" directory$`, iRunInDirectory) - s.Step(`^I run "([^"]*)" in "([^"]*)"$`, iRunInDirectory) + s.Step(`^I run "([^"]*)" in "([^"]*)" directory$`, test.IRunInDirectory) + s.Step(`^I run "([^"]*)" in "([^"]*)"$`, test.IRunInDirectory) s.Step(`^I set "([^"]*)" to "([^"]*)"$`, iSetTo) - s.Step(`^my workstation fulfill the requirements$`, func() error { return iRunInDirectory("./check_requirement_workstation.sh", "scripts") }) + s.Step(`^my workstation fulfill the requirements$`, func() error { return test.IRunInDirectory("./check_requirement_workstation.sh", "scripts") }) s.Step(`^the "([^"]*)" is set to "([^"]*)"$`, theIsSetTo) s.Step(`^the "([^"]*)" repository exist$`, theRepositoryExist) s.Step(`^the directory "([^"]*)" exist$`, theDirectoryExist) s.Step(`^the file "([^"]*)" exist$`, theFileExist) - s.Step(`^the output contains "([^"]*)" and "([^"]*)"$`, theOutputContainsAnd) + s.Step(`^the output contains "([^"]*)" and "([^"]*)" and "([^"]*)"$`, test.TheOutputContainsAndAnd) + s.Step(`^the output contains "([^"]*)" and "([^"]*)"$`, test.TheOutputContainsAnd) + s.Step(`^the output contains "([^"]*)" or "([^"]*)"$`, test.TheOutputContainsOr) + s.Step(`^the output contains "([^"]*)" or "([^"]*)" or "([^"]*)"$`, test.TheOutputContainsOrOr) s.Step(`^there is "([^"]*)" directory$`, theDirectoryExist) s.Step(`^there is no "([^"]*)" directory$`, thereIsNoDirectory) - s.Step(`^I run "([^"]*)"$`, func(command string) error { return iRunInDirectory(command, ".") }) - s.Step(`^the output contains "([^"]*)"$`, theOutputContains) - s.Step(`^I have the correct go version$`, func() error { return iRunInDirectory("make go-version-check", "skuba") }) - + s.Step(`^I run VAR:"([^"]*)"$`, test.IRunVAR) + s.Step(`^I run "([^"]*)"$`, test.Irun) + s.Step(`^the output contains "([^"]*)"$`, test.TheOutputContains) + s.Step(`^I have the correct go version$`, func() error { return test.IRunInDirectory("make go-version-check", "skuba") }) + s.Step(`^grep for "([^"]*)"$`, test.GrepFor) + s.Step(`^I run "([^"]*)" expecting ERROR:"([^"]*)" in VAR:"([^"]*)" directory$`, test.IRunExpectingERRORInVARDirectory) + //--------------------Cilium-specific test functions----------------------------------------------- + s.Step(`^I run VARS:"([^"]*)" and check for "([^"]*)" and "([^"]*)"$`, test.IRunVARSAndCheckForAnd) + s.Step(`^VARIABLE "([^"]*)" equals ContainersFROMOutput "([^"]*)"$`, test.VARIABLEEqualsContainersFROMOutput) + s.Step(`^VARIABLE "([^"]*)" equals ContainerFROMOutput "([^"]*)"$`, test.VARIABLEEqualsContainerFROMOutput) + s.Step(`^I run "([^"]*)" expecting ERROR$`, test.IRunExpectingERROR) + s.Step(`^I run VAR:"([^"]*)" expecting ERROR$`, test.IRunVARExpectingERROR) + s.Step(`^I run VAR:"([^"]*)" expecting ERROR in VAR:"([^"]*)" directory$`, test.IRunVARExpectingERRORInVARDirectory) + s.Step(`^the error contains "([^"]*)" and "([^"]*)"$`, test.TheErrorContainsAnd) + s.Step(`^I run VAR:"([^"]*)" in VAR:"([^"]*)" directory$`, test.IRunVARInVARDirectory) + s.Step(`^VARIABLES "([^"]*)" equals "([^"]*)" plus VAR:"([^"]*)"$`, test.VARIABLESEqualsPlusVAR) + s.Step(`^VARIABLE "([^"]*)" equals "([^"]*)" plus VAR:"([^"]*)"$`, test.VARIABLEEqualsPlusVAR) + s.Step(`^VARIABLE "([^"]*)" equals "([^"]*)" plus VAR:"([^"]*)" plus "([^"]*)"$`, test.VARIABLEEqualsPlusVARPlus) + s.Step(`^I run "([^"]*)" in VAR:"([^"]*)" directory$`, test.IRunInVARDirectory) + s.Step(`^VARIABLE "([^"]*)" equals "([^"]*)"$`, test.VARIABLEEquals) + //------------------------------------------------------------------------------------------------- + //-------------------Kured-specific test functions------------------------------------------------- + s.Step(`^I run VARS:"([^"]*)" and IPSFromOutput$`, test.IRunVARSAndIPSFromOutput) + s.Step(`^I run SSHCMD "([^"]*)" on MASTER$`, test.IRunSSHCMDOnMASTER) + s.Step(`^I insert in OUTPUT "([^"]*)" and save it to kurednew\.yaml$`, test.IInsertInOUTPUTAndSaveItToKurednewyaml) + //-------------------Skuba Upgrade - specific test fuctions---------------------------------------- + s.Step(`^I run UPGRADE VARS:"([^"]*)" in VAR:"([^"]*)" directory$`, test.IRunUPGRADEVARSInVARDirectory) + s.Step(`^VARIABLES "([^"]*)" equals "([^"]*)" plus Master Nodes$`, test.VARIABLESEqualsPlusMasterNodes) + s.Step(`^VARIABLES "([^"]*)" equals "([^"]*)" plus Worker Nodes$`, test.VARIABLESEqualsPlusWorkerNodes) + s.Step(`^VARIABLES "([^"]*)" equals "([^"]*)" plus Master Node IPS$`, test.VARIABLESEqualsPlusMasterNodeIPS) + s.Step(`^VARIABLES "([^"]*)" equals "([^"]*)" plus Worker Node IPS$`, test.VARIABLESEqualsPlusWorkerNodeIPS) + s.Step(`^I replace Cilium Version in OUTPUT and save it into skubaconf\.yaml file$`, test.IReplaceCiliumVersionInOUTPUTAndSaveItIntoSkubaconfyamlFile) + s.Step(`^I replace Gangway Version in OUTPUT and save it into skubaconf\.yaml file$`, test.IReplaceGangwayVersionInOUTPUTAndSaveItIntoSkubaconfyamlFile) }