Add common functions to run mcp-qa tests
- Added RunTest package with function to run test
- Added EnvActions package with functions to manipulate env
- Added Common package with common functions
Change-Id: I921c75f990e182c1264aeecf29780b2390cfcc9c
diff --git a/src/com/mirantis/mcp-qa/EnvActions.groovy b/src/com/mirantis/mcp-qa/EnvActions.groovy
new file mode 100644
index 0000000..03a6a1b
--- /dev/null
+++ b/src/com/mirantis/mcp-qa/EnvActions.groovy
@@ -0,0 +1,34 @@
+package com.mirantis.mcp-qa
+
+/**
+ * Activate virtual environment and check k8s deployer is specified
+ */
+
+def prepareEnv() {
+ sh '''
+ if [ ! -r "${VENV_PATH}/bin/activate" ]; then
+ echo 'Python virtual environment not found! Set correct VENV_PATH!'
+ exit 1
+ fi
+ '''
+
+ sh '''
+ if [ ! -r "${WORKSPACE}/fuel-ccp-installer/${DEPLOY_SCRIPT_REL_PATH}" ]; then
+ echo "Deploy script \"${DEPLOY_SCRIPT_REL_PATH}\" not found in" \
+ "\"${WORKSPACE}/fuel-ccp-installer/\"!"
+ fi
+ '''
+}
+
+/**
+ * Destroy running environment
+ */
+
+def destroyEnv() {
+ if ( !(env.KEEP_BEFORE.equals('yes') || env.KEEP_BEFORE.equals('true')) ) {
+ sh '''
+ . ${VENV_PATH}/bin/activate
+ dos.py destroy ${ENV_NAME} || true
+ '''
+ }
+}