Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding project account and cluster account testcases #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,24 @@ metrics-check:
- chmod 755 ./stages/7-metrics-check/metrics-check
- ./stages/7-metrics-check/metrics-check

trpa01-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

trca01-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
Expand Down
2 changes: 2 additions & 0 deletions stages/8-teaming-check/teaming-change-role-check
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]/mayadata-io/oep-e2e.git

######################
Expand Down
1 change: 1 addition & 0 deletions stages/8-teaming-check/teaming-change-role-negative-check
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
42 changes: 42 additions & 0 deletions stages/8-teaming-check/teaming-cluster-account-resources-check
Original file line number Diff line number Diff line change
@@ -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: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:[email protected]/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:trca01-teaming-cluster-account-resources-check jobphase:Completed
fi
5 changes: 2 additions & 3 deletions stages/8-teaming-check/teaming-invite-check
Original file line number Diff line number Diff line change
Expand Up @@ -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:trca01-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:[email protected]/mayadata-io/oep-e2e.git
echo "Validate teaming invitation process --------------------------------------------"
Expand Down
46 changes: 46 additions & 0 deletions stages/8-teaming-check/teaming-project-account-resources-check
Original file line number Diff line number Diff line change
@@ -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: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

# cloning oep-e2e testcases repository
git clone https://$username:[email protected]/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:trpa01-teaming-project-account-resources-check jobphase:Completed
fi