From 23742eec48b95932b2ef40a6a2b07af2de329cf1 Mon Sep 17 00:00:00 2001 From: harshita-sharma011 Date: Mon, 30 Mar 2020 04:21:55 +0530 Subject: [PATCH 1/2] Adding project account and cluster account testcases --- .gitlab-ci.yml | 18 ++++++++ .../8-teaming-check/teaming-change-role-check | 2 + .../teaming-change-role-negative-check | 1 + .../teaming-cluster-account-resources-check | 42 +++++++++++++++++ stages/8-teaming-check/teaming-invite-check | 5 +- .../teaming-project-account-resources-check | 46 +++++++++++++++++++ 6 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 stages/8-teaming-check/teaming-cluster-account-resources-check create mode 100644 stages/8-teaming-check/teaming-project-account-resources-check diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a5218c..7c21a3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -410,6 +410,24 @@ metrics-check: - chmod 755 ./stages/7-metrics-check/metrics-check - ./stages/7-metrics-check/metrics-check +teaming-project-account-resources-check: + image: harshshekhar15/gitlab-job:v3 + stage: TEAMING-CHECK + dependencies: + - cluster-setup-check + script: + - chmod 755 ./stages/8-teaming-check/teaming-project-account-resources-check + - ./stages/8-teaming-check/teaming-project-account-resources-check + +teaming-cluster-account-resources-check: + image: harshshekhar15/gitlab-job:v3 + stage: TEAMING-CHECK + dependencies: + - cluster-setup-check + script: + - chmod 755 ./stages/8-teaming-check/teaming-cluster-account-resources-check + - ./stages/8-teaming-check/teaming-cluster-account-resources-check + triv01-teaming-invite-check: image: harshshekhar15/gitlab-job:v3 stage: TEAMING-CHECK diff --git a/stages/8-teaming-check/teaming-change-role-check b/stages/8-teaming-check/teaming-change-role-check index c613d49..e152f92 100644 --- a/stages/8-teaming-check/teaming-change-role-check +++ b/stages/8-teaming-check/teaming-change-role-check @@ -12,9 +12,11 @@ gcloud auth activate-service-account --key-file=key.json gcloud config set project openebs-ci export GOOGLE_APPLICATION_CREDENTIALS="$path/key.json" +# running following scripts to run the gitlab job sequentially bash utils/pooling jobname:triv01-teaming-invite-check bash utils/e2e-cr jobname:trrc02-teaming-change-role-check jobphase:Running +# cloning oep-e2e testcases repository git clone https://$username:$password@github.com/mayadata-io/oep-e2e.git ###################### diff --git a/stages/8-teaming-check/teaming-change-role-negative-check b/stages/8-teaming-check/teaming-change-role-negative-check index 6d6987b..b0d54e4 100644 --- a/stages/8-teaming-check/teaming-change-role-negative-check +++ b/stages/8-teaming-check/teaming-change-role-negative-check @@ -12,6 +12,7 @@ gcloud auth activate-service-account --key-file=key.json gcloud config set project openebs-ci export GOOGLE_APPLICATION_CREDENTIALS="$path/key.json" +# running following scripts to run the gitlab job sequentially bash utils/pooling jobname:trrc02-teaming-change-role-check bash utils/e2e-cr jobname:trrc03-teaming-change-role-negative-check jobphase:Running diff --git a/stages/8-teaming-check/teaming-cluster-account-resources-check b/stages/8-teaming-check/teaming-cluster-account-resources-check new file mode 100644 index 0000000..b9152a4 --- /dev/null +++ b/stages/8-teaming-check/teaming-cluster-account-resources-check @@ -0,0 +1,42 @@ + +#!/bin/bash + +set -e + +# copy the user cluster config to ~/.kube/config inorder to access user cluster +path=$(pwd) +mkdir ~/.kube +cp .gcp/config ~/.kube/config + +# running following scripts to run the gitlab job sequentially +bash utils/pooling jobname:teaming-project-account-resources-check +bash utils/e2e-cr jobname:teaming-cluster-account-resources-check jobphase:Running + +# cloning oep-e2e testcases repository +git clone https://$username:$password@github.com/mayadata-io/oep-e2e.git + +###################### +## Running test ## +###################### + +echo "Validate teaming cluster account access resources --------------------------------------------" +kubectl create -f oep-e2e/litmus/director/account-access/cluster-account/run_litmus_test.yml +test_name=cluster-account-resources-check +echo $test_name +litmus_pod=$(kubectl get po -n litmus | grep $test_name | awk {'print $1'} | tail -n 1) +echo $litmus_pod +job_status=$(kubectl get po $litmus_pod -n litmus | awk {'print $3'} | tail -n 1) +while [[ "$job_status" != "Completed" ]] +do + job_status=$(kubectl get po $litmus_pod -n litmus | awk {'print $3'} | tail -n 1) + sleep 6 +done +kubectl logs -f $litmus_pod -n litmus +testResult=$(kubectl get litmusresult ${test_name} --no-headers -o custom-columns=:spec.testStatus.result) +echo $testResult +if [ "$testResult" != Pass ] +then + exit 1; +else + bash utils/e2e-cr jobname:teaming-cluster-account-resources-check jobphase:Completed +fi \ No newline at end of file diff --git a/stages/8-teaming-check/teaming-invite-check b/stages/8-teaming-check/teaming-invite-check index d186073..19fbcc1 100644 --- a/stages/8-teaming-check/teaming-invite-check +++ b/stages/8-teaming-check/teaming-invite-check @@ -15,10 +15,9 @@ export GOOGLE_APPLICATION_CREDENTIALS="$path/key.json" echo "***Applying e2e-crd***********" kubectl apply -f utils/e2e-crd.yml -bash utils/e2e-cr jobname:triv01-teaming-invite-check jobphase:Waiting +# running following scripts to run the gitlab job sequentially +bash utils/pooling jobname:teaming-cluster-account-resources-check bash utils/e2e-cr jobname:triv01-teaming-invite-check jobphase:Running -bash utils/e2e-cr jobname:trrc02-teaming-change-role-check jobphase:Waiting -bash utils/e2e-cr jobname:trrc03-teaming-change-role-negative-check jobphase:Waiting git clone https://$username:$password@github.com/mayadata-io/oep-e2e.git echo "Validate teaming invitation process --------------------------------------------" diff --git a/stages/8-teaming-check/teaming-project-account-resources-check b/stages/8-teaming-check/teaming-project-account-resources-check new file mode 100644 index 0000000..31bdd3a --- /dev/null +++ b/stages/8-teaming-check/teaming-project-account-resources-check @@ -0,0 +1,46 @@ + +#!/bin/bash + +set -e + +# copy the user cluster config to ~/.kube/config inorder to access user cluster +path=$(pwd) +mkdir ~/.kube +cp .gcp/config ~/.kube/config + +# running following scripts to run the gitlab job sequentially +bash utils/e2e-cr jobname:teaming-project-account-resources-check jobphase:Waiting +bash utils/e2e-cr jobname:teaming-project-account-resources-check jobphase:Running +bash utils/e2e-cr jobname:teaming-cluster-account-resources-check jobphase:Waiting +bash utils/e2e-cr jobname:triv01-teaming-invite-check jobphase:Waiting +bash utils/e2e-cr jobname:trrc02-teaming-change-role-check jobphase:Waiting +bash utils/e2e-cr jobname:trrc03-teaming-change-role-negative-check jobphase:Waiting + +# cloning oep-e2e testcases repository +git clone https://$username:$password@github.com/mayadata-io/oep-e2e.git + +###################### +## Running test ## +###################### + +echo "Validate teaming project account access resources --------------------------------------------" +kubectl create -f oep-e2e/litmus/director/account-access/project-account/run_litmus_test.yml +test_name=project-account-resources-check +echo $test_name +litmus_pod=$(kubectl get po -n litmus | grep $test_name | awk {'print $1'} | tail -n 1) +echo $litmus_pod +job_status=$(kubectl get po $litmus_pod -n litmus | awk {'print $3'} | tail -n 1) +while [[ "$job_status" != "Completed" ]] +do + job_status=$(kubectl get po $litmus_pod -n litmus | awk {'print $3'} | tail -n 1) + sleep 6 +done +kubectl logs -f $litmus_pod -n litmus +testResult=$(kubectl get litmusresult ${test_name} --no-headers -o custom-columns=:spec.testStatus.result) +echo $testResult +if [ "$testResult" != Pass ] +then + exit 1; +else + bash utils/e2e-cr jobname:teaming-project-account-resources-check jobphase:Completed +fi \ No newline at end of file From 1d80cbcb5e748a0db37368231ea67a0d4f591e5e Mon Sep 17 00:00:00 2001 From: harshita-sharma011 Date: Fri, 3 Apr 2020 07:55:29 +0530 Subject: [PATCH 2/2] adding test-case-ids to gitlab jobs --- .gitlab-ci.yml | 4 ++-- .../teaming-cluster-account-resources-check | 6 +++--- stages/8-teaming-check/teaming-invite-check | 2 +- .../teaming-project-account-resources-check | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c21a3d..0ea4bf6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -410,7 +410,7 @@ metrics-check: - chmod 755 ./stages/7-metrics-check/metrics-check - ./stages/7-metrics-check/metrics-check -teaming-project-account-resources-check: +trpa01-teaming-project-account-resources-check: image: harshshekhar15/gitlab-job:v3 stage: TEAMING-CHECK dependencies: @@ -419,7 +419,7 @@ teaming-project-account-resources-check: - chmod 755 ./stages/8-teaming-check/teaming-project-account-resources-check - ./stages/8-teaming-check/teaming-project-account-resources-check -teaming-cluster-account-resources-check: +trca01-teaming-cluster-account-resources-check: image: harshshekhar15/gitlab-job:v3 stage: TEAMING-CHECK dependencies: diff --git a/stages/8-teaming-check/teaming-cluster-account-resources-check b/stages/8-teaming-check/teaming-cluster-account-resources-check index b9152a4..a3ddbee 100644 --- a/stages/8-teaming-check/teaming-cluster-account-resources-check +++ b/stages/8-teaming-check/teaming-cluster-account-resources-check @@ -9,8 +9,8 @@ mkdir ~/.kube cp .gcp/config ~/.kube/config # running following scripts to run the gitlab job sequentially -bash utils/pooling jobname:teaming-project-account-resources-check -bash utils/e2e-cr jobname:teaming-cluster-account-resources-check jobphase:Running +bash utils/pooling jobname:trpa01-teaming-project-account-resources-check +bash utils/e2e-cr jobname:trca01-teaming-cluster-account-resources-check jobphase:Running # cloning oep-e2e testcases repository git clone https://$username:$password@github.com/mayadata-io/oep-e2e.git @@ -38,5 +38,5 @@ if [ "$testResult" != Pass ] then exit 1; else - bash utils/e2e-cr jobname:teaming-cluster-account-resources-check jobphase:Completed + bash utils/e2e-cr jobname:trca01-teaming-cluster-account-resources-check jobphase:Completed fi \ No newline at end of file diff --git a/stages/8-teaming-check/teaming-invite-check b/stages/8-teaming-check/teaming-invite-check index 19fbcc1..14d2f9c 100644 --- a/stages/8-teaming-check/teaming-invite-check +++ b/stages/8-teaming-check/teaming-invite-check @@ -16,7 +16,7 @@ echo "***Applying e2e-crd***********" kubectl apply -f utils/e2e-crd.yml # running following scripts to run the gitlab job sequentially -bash utils/pooling jobname:teaming-cluster-account-resources-check +bash utils/pooling jobname:trca01-teaming-cluster-account-resources-check bash utils/e2e-cr jobname:triv01-teaming-invite-check jobphase:Running git clone https://$username:$password@github.com/mayadata-io/oep-e2e.git diff --git a/stages/8-teaming-check/teaming-project-account-resources-check b/stages/8-teaming-check/teaming-project-account-resources-check index 31bdd3a..3b476fe 100644 --- a/stages/8-teaming-check/teaming-project-account-resources-check +++ b/stages/8-teaming-check/teaming-project-account-resources-check @@ -9,9 +9,9 @@ mkdir ~/.kube cp .gcp/config ~/.kube/config # running following scripts to run the gitlab job sequentially -bash utils/e2e-cr jobname:teaming-project-account-resources-check jobphase:Waiting -bash utils/e2e-cr jobname:teaming-project-account-resources-check jobphase:Running -bash utils/e2e-cr jobname:teaming-cluster-account-resources-check jobphase:Waiting +bash utils/e2e-cr jobname:trpa01-teaming-project-account-resources-check jobphase:Waiting +bash utils/e2e-cr jobname:trpa01-teaming-project-account-resources-check jobphase:Running +bash utils/e2e-cr jobname:trca01-teaming-cluster-account-resources-check jobphase:Waiting bash utils/e2e-cr jobname:triv01-teaming-invite-check jobphase:Waiting bash utils/e2e-cr jobname:trrc02-teaming-change-role-check jobphase:Waiting bash utils/e2e-cr jobname:trrc03-teaming-change-role-negative-check jobphase:Waiting @@ -42,5 +42,5 @@ if [ "$testResult" != Pass ] then exit 1; else - bash utils/e2e-cr jobname:teaming-project-account-resources-check jobphase:Completed + bash utils/e2e-cr jobname:trpa01-teaming-project-account-resources-check jobphase:Completed fi \ No newline at end of file