Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
E
e2e-packet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
openebs
e2e-packet
Commits
950aca2e
Unverified
Commit
950aca2e
authored
Nov 02, 2018
by
dargasudarshan
Committed by
GitHub
Nov 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4 from gprasath/func_test
Including functional tests into packet pipeline
parents
ea50e4e9
c3b1b2ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
270 additions
and
0 deletions
+270
-0
.gitlab-ci.yml
.gitlab-ci.yml
+10
-0
memory-consumption
script/apps/memleak/tests/jiva/memory-consumption
+130
-0
k8s-snapshot-clone
script/apps/percona/functional/jiva/k8s-snapshot-clone
+130
-0
No files found.
.gitlab-ci.yml
View file @
950aca2e
...
...
@@ -159,6 +159,16 @@ volume-data-integrity-{fio-jiva}:
script
:
-
./script/apps/fio/tests/jiva/fio-volume-data-integrity-check
volume-memory-consumption-{memcheck-jiva}
:
extends
:
.func_test_template
script
:
-
./script/apps/memleak/tests/jiva/memory-consumption
snapshot-clone-creation-{percona-jiva}
:
extends
:
.func_test_template
script
:
-
./script/apps/percona/functional/jiva/k8s-snapshot-clone
## Define job template for chaos jobs
.chaos_test_template
:
...
...
script/apps/memleak/tests/jiva/memory-consumption
0 → 100755
View file @
950aca2e
#!/bin/bash
set
-x
#################
## ENVIRONMENT ##
#################
## TODO: Ideally, run_metadata should be passed as gitlab runner (CI runtime) ENV
run_metadata
=
""
## https://github.com/openebs/litmus/blob/master/apps/fio/tests/data-integrity/test_vars.yml
test_name
=
"memleak-test"
if
[[
-n
"
$run_metadata
"
]]
;
then
test_name
=
"
$test_name
-
$run_metadata
"
fi
################
## FUNCTIONS ##
################
error_handler
()
{
rc
=
$1
;
message
=
$(
echo
$2
|
cut
-d
"="
-f
2
)
;
act
=
$(
echo
$3
|
cut
-d
"="
-f
2
)
if
[
$rc
-ne
0
]
;
then
echo
"
$message
"
if
[
"
$act
"
==
"exit"
]
;
then
exit
1
fi
fi
}
task_delimiter
()
{
printf
'%*s\n'
"
${
COLUMNS
:-$(
tput cols
)}
"
''
|
tr
' '
"%"
}
###################
## DEPENDENCIES ##
###################
## Derive the kubeconfig of the packet cluster into the gitlab job runner pod
echo
"Setting up test dependencies.."
mkdir
~/.kube
cp
-r
openebs-packet/.kube/. ~/.kube/
git clone https://github.com/openebs/litmus.git
cd
litmus
task_delimiter
;
############################
## LITMUS PRECONDITIONING ##
############################
## TODO: Add logic to replace job ENV (SC, PVC, LABEL, NS) based on run instance intent
## TODO: Add logic to add ENV for run_instance_metadata/RunID
#Test
#################
## RUNNER MAIN ##
#################
echo
"Running the litmus test.."
## Create the litmus job for fio data integrity test
jobNameCmd
=
"kubectl get jobs -n litmus --no-headers -o jsonpath='{.items[?(@.metadata.labels.app==
\"
memleak-test
\"
)].metadata.name}'"
job_deploy_out
=
$(
kubectl create
-f
apps/memleak/tests/run_litmus_test.yml
)
&&
\
job_name
=
$(
eval
$jobNameCmd
)
;
retcode
=
$?
error_handler
$retcode
msg
=
"Unable to run litmusbook, exiting"
action
=
"exit"
## Obtain the litmus pod name
litmusPodCmd
=
"kubectl get pod --no-headers -n litmus -o jsonpath='{.items[?(@.metadata.labels.job-name==
\"
$job_name
\"
)].metadata.name}'"
litmus_pod
=
$(
eval
$litmusPodCmd
)
;
retcode
=
$?
error_handler
$retcode
msg
=
"Unable to find litmus test runner pod, exiting"
action
=
"exit"
## Wait till the ansibletest container terminates && also confirm job completion status. This is done to ensure
## that execution of auxiliary containers such as loggers is completed. Getting the ansibletest ccontainer to completed state
## satisfies the "necessary" condition for test job completion
containerStateCmd
=
"kubectl get pod
${
litmus_pod
}
-n litmus -o jsonpath='{.status.containerStatuses[?(@.name==
\"
ansibletest
\"
)].state}'"
jobStateCmd
=
"kubectl get pod
${
litmus_pod
}
--no-headers -n litmus -o custom-columns=:status.phase"
## TODO: Consider cases where litmus pod is evicted
while
[[
!
$(
eval
$containerStateCmd
)
=
~
'terminated'
]]
;
do
sleep
1
done
while
[[
$(
eval
$jobStateCmd
)
=
~
'Running'
]]
;
do
sleep
1
done
echo
"Litmus test run Job has completed"
task_delimiter
;
## Printing the test logs & cluster state for debug purposes
echo
"Dumping Litmus test pod logs for debug"
;
echo
""
kubectl logs
$litmus_pod
-n
litmus
-c
ansibletest
task_delimiter
;
echo
"Dumping state of cluster post job run"
;
echo
""
kubectl get pods
--all-namespaces
kubectl get pvc
--all-namespaces
kubectl get sc
task_delimiter
;
## Check the test status & result from the litmus result custom resource
testStatus
=
$(
kubectl get lr
$test_name
--no-headers
-o
custom-columns
=
:spec.testStatus.phase
)
&&
\
testResult
=
$(
kubectl get lr
$test_name
--no-headers
-o
custom-columns
=
:spec.testStatus.result
)
;
retcode
=
$?
error_handler
$retcode
msg
=
"Unable to find litmus result custom resource, exiting"
action
=
"exit"
if
[[
$testStatus
==
"completed"
]]
;
then
if
[[
$testResult
==
"Pass"
]]
;
then
echo
"TEST: PASS"
else
echo
"TEST: FAILED"
;
exit
1
fi
else
echo
"Test Execution was aborted"
;
exit
1
fi
script/apps/percona/functional/jiva/k8s-snapshot-clone
0 → 100755
View file @
950aca2e
#!/bin/bash
set
-x
#################
## ENVIRONMENT ##
#################
## TODO: Ideally, run_metadata should be passed as gitlab runner (CI runtime) ENV
run_metadata
=
""
## https://github.com/openebs/litmus/blob/master/apps/percona/functional/k8s_snapshot/test_vars.yml
test_name
=
"create-k8s-snapshot-clone"
if
[[
-n
"
$run_metadata
"
]]
;
then
test_name
=
"
$test_name
-
$run_metadata
"
fi
################
## FUNCTIONS ##
################
error_handler
()
{
rc
=
$1
;
message
=
$(
echo
$2
|
cut
-d
"="
-f
2
)
;
act
=
$(
echo
$3
|
cut
-d
"="
-f
2
)
if
[
$rc
-ne
0
]
;
then
echo
"
$message
"
if
[
"
$act
"
==
"exit"
]
;
then
exit
1
fi
fi
}
task_delimiter
()
{
printf
'%*s\n'
"
${
COLUMNS
:-$(
tput cols
)}
"
''
|
tr
' '
"%"
}
###################
## DEPENDENCIES ##
###################
## Derive the kubeconfig of the packet cluster into the gitlab job runner pod
echo
"Setting up test dependencies.."
mkdir
~/.kube
cp
-r
openebs-packet/.kube/. ~/.kube/
## Clone the litmus repo, checkout the e2e branch, navigate to litmus root
git clone https://github.com/openebs/litmus.git
cd
litmus
task_delimiter
;
############################
## LITMUS PRECONDITIONING ##
############################
## TODO: Add logic to replace job ENV (SC, PVC, LABEL, NS) based on run instance intent
## TODO: Add logic to add ENV for run_instance_metadata/RunID
#################
## RUNNER MAIN ##
#################
echo
"Running the litmus test.."
## Create the litmus job for cassandra app func test: scale-app-replicas
jobNameCmd
=
"kubectl get jobs -n litmus --no-headers -o jsonpath='{.items[?(@.metadata.labels.app==
\"
k8s-snapshot-litmus
\"
)].metadata.name}'"
job_deploy_out
=
$(
kubectl create
-f
apps/percona/functional/k8s_snapshot/run_litmus_test.yml
)
&&
\
job_name
=
$(
eval
$jobNameCmd
)
;
retcode
=
$?
error_handler
$retcode
msg
=
"Unable to run litmusbook, exiting"
action
=
"exit"
## Obtain the litmus pod name
litmusPodCmd
=
"kubectl get pod --no-headers -n litmus -o jsonpath='{.items[?(@.metadata.labels.job-name==
\"
$job_name
\"
)].metadata.name}'"
litmus_pod
=
$(
eval
$litmusPodCmd
)
;
retcode
=
$?
error_handler
$retcode
msg
=
"Unable to find litmus test runner pod, exiting"
action
=
"exit"
## Wait till the ansibletest container terminates && also confirm job completion status. This is done to ensure
## that execution of auxiliary containers such as loggers is completed. Getting the ansibletest ccontainer to completed state
## satisfies the "necessary" condition for test job completion
containerStateCmd
=
"kubectl get pod
${
litmus_pod
}
-n litmus -o jsonpath='{.status.containerStatuses[?(@.name==
\"
ansibletest
\"
)].state}'"
jobStateCmd
=
"kubectl get pod
${
litmus_pod
}
--no-headers -n litmus -o custom-columns=:status.phase"
## TODO: Consider cases where litmus pod is evicted
while
[[
!
$(
eval
$containerStateCmd
)
=
~
'terminated'
]]
;
do
sleep
1
done
while
[[
$(
eval
$jobStateCmd
)
=
~
'Running'
]]
;
do
sleep
1
done
echo
"Litmus test run Job has completed"
task_delimiter
;
## Printing the test logs & cluster state for debug purposes
echo
"Dumping Litmus test pod logs for debug"
;
echo
""
kubectl logs
$litmus_pod
-n
litmus
-c
ansibletest
task_delimiter
;
echo
"Dumping state of cluster post job run"
;
echo
""
kubectl get pods
--all-namespaces
kubectl get pvc
--all-namespaces
kubectl get sc
task_delimiter
;
## Check the test status & result from the litmus result custom resource
testStatus
=
$(
kubectl get litmusresult
$test_name
--no-headers
-o
custom-columns
=
:spec.testStatus.phase
)
&&
\
testResult
=
$(
kubectl get litmusresult
$test_name
--no-headers
-o
custom-columns
=
:spec.testStatus.result
)
;
retcode
=
$?
error_handler
$retcode
msg
=
"Unable to find litmus result custom resource, exiting"
action
=
"exit"
if
[[
$testStatus
==
"completed"
]]
;
then
if
[[
$testResult
==
"Pass"
]]
;
then
echo
"TEST: PASS"
else
echo
"TEST: FAILED"
;
exit
1
fi
else
echo
"Test Execution was aborted"
;
exit
1
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment