Adapt xtesting-onap to stack oriented framework
This commit adds an initial testing capability for onap with the following two testsuits
support.
1. infra-healthcheck
2. healthcheck
Signed-off-by: eprasad <prasad.mukhedkar@est.tech>
Change-Id: I1f669880ba7ae9301c8f86974072e114ae28951d
Signed-off-by: eprasad <prasad.mukhedkar@est.tech>
diff --git a/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.j2 b/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.j2
new file mode 100644
index 0000000..559a3c2
--- /dev/null
+++ b/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.j2
@@ -0,0 +1,46 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: "xtesting-onap-{{ test_type }}"
+ namespace: onap
+spec:
+ template:
+ spec:
+ containers:
+ - env:
+ - name: INSTALLER_TYPE
+ value: kubespray-oom
+ - name: DEPLOY_SCENARIO
+ value: "{{ deploy_scenario }}"
+ - name: NODE_NAME
+ value: {{ lookup('env', 'POD_NAME') | default('noname', true) }}
+ - name: TEST_DB_URL
+ value: http://testresults.opnfv.org/onap/api/v1/results
+ - name: BUILD_TAG
+ value: "{{ lookup('env', 'BUILD_TAG') | default('notag', true) }}"
+ - name: TAG
+ value: "{{ test_type }}"
+ image: "{{ testfw_image_name }}@sha256:{{ testfw_image_version }}"
+ imagePullPolicy: Always
+ name: xtesting-onap
+ volumeMounts:
+ - mountPath: /etc/localtime
+ name: localtime
+ readOnly: true
+ - mountPath: /share/config
+ name: robot-eteshare
+ - mountPath: /var/lib/xtesting/results/
+ name: robot-save-results
+ restartPolicy: Never
+ volumes:
+ - hostPath:
+ path: /etc/localtime
+ name: localtime
+ - configMap:
+ defaultMode: 493
+ name: onapdep-robot-eteshare-configmap
+ name: robot-eteshare
+ - hostPath:
+ path: "{{ testfw_resultdir }}"
+ type: DirectoryOrCreate
+ name: robot-save-results
diff --git a/playbooks/roles/prepare-testframework/templates/xtesting.env.j2 b/playbooks/roles/prepare-testframework/templates/xtesting.env.j2
new file mode 100644
index 0000000..ec7bf5e
--- /dev/null
+++ b/playbooks/roles/prepare-testframework/templates/xtesting.env.j2
@@ -0,0 +1,6 @@
+BUILD_TAG={{ lookup('env', 'BUILD_TAG') }}
+ENERGY_RECORDER_API_URL=http://energy.opnfv.fr/resources
+CI_LOOP=daily
+TEST_DB_URL=http://testresults.opnfv.org/onap/api/v1/results
+INSTALLER_TYPE=kubespray-oom
+NODE_NAME={{ lookup('env', 'POD_NAME') | default('noname', true) }}
diff --git a/playbooks/roles/prepare-testframework/templates/xtesting.sh.j2 b/playbooks/roles/prepare-testframework/templates/xtesting.sh.j2
new file mode 100755
index 0000000..226ba86
--- /dev/null
+++ b/playbooks/roles/prepare-testframework/templates/xtesting.sh.j2
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+declare -i retval=0
+
+sudo docker run --rm --env-file {{ testfw_workdir }}/xtesting.env \
+ -v $HOME/.kube/config:/root/.kube/config \
+ -v {{ testfw_resultdir }}:/var/lib/xtesting/results \
+ {{ testfw_image_name }}@sha256:{{ testfw_image_version }} \
+ run_tests -r -t {{ testcase }}
+ retval=$(($retval + $?))
+
+exit $retval