Skip to content
Snippets Groups Projects
Commit 3e2888a3 authored by Michael Davis's avatar Michael Davis
Browse files

[ci] Creates migration test stage

parent 25bf911b
Branches
Tags
No related merge requests found
......@@ -3,6 +3,7 @@ stages:
- build:rpm
- build:dockerimage
- rename:dockerimage
- migrationtest
- test
- regressions
- shouldfail
......@@ -122,7 +123,6 @@ cta_valgrind:
tags:
- docker
ctageneric_docker:
except:
- tags
......@@ -136,7 +136,6 @@ ctageneric_docker:
TO: gitlab-registry.cern.ch/cta/ctageneric:${CI_PIPELINE_ID}
DOCKER_FILE: continuousintegration/docker/ctafrontend/cc7/ci_runner/Dockerfile
ctageneric_docker_rename:
except:
- tags
......@@ -151,7 +150,23 @@ ctageneric_docker_rename:
- cd continuousintegration/ci_helpers/
- ./rename_tag.sh
migration:
except:
- tags
stage: migrationtest
retry: 1
script:
- export NAMESPACE="migration-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/migration.sh -O -D -t 2400
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
- mhvtl
archiveretrieve:
except:
- tags
......@@ -191,7 +206,7 @@ nightly1:
only:
- triggers
script:
- echo "Running nightly tests"
- echo "Running nightly tests"
- export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/test_nightly1.sh -O -D
artifacts:
......
#!/bin/sh
# Colours
NC='\033[0m' # No colour
RED='\033[0;31m'
LT_RED='\033[1;31m'
GREEN='\033[0;32m'
LT_GREEN='\033[1;32m'
ORANGE='\033[0;33m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
LT_BLUE='\033[1;34m'
error()
{
echo -e "${RED}$*${NC}" >&2
exit 1
}
echoc()
{
COLOUR=$1
shift
echo -e "${COLOUR}$*${NC}"
}
TEST_PATH=$(which eos-test-dir-inject)
[ -x ${TEST_PATH} ] || error "Can't find executable eos-test-dir-inject"
CONFIG_FILE=/etc/cta/castor-migration.conf
[ -r ${CONFIG_FILE} ] || error "Can't find configuration file ${CONFIG_FILE}"
TMPFILE=/tmp/eos-test-inject-sh.$$
CASTOR_PREFIX=$(awk '/^castor.prefix[ ]/ { print $2 }' ${CONFIG_FILE})
EOS_PREFIX=$(awk '/^eos.prefix[ ]/ { print $2 }' ${CONFIG_FILE})
# Create the top-level directory. GNU coreutils "mkdir -p" does not return an error if the directory
# already exists; "eos mkdir -p" does return an error, which we explicitly ignore.
eos mkdir -p ${EOS_PREFIX} 2>/dev/null
# Create directory with system-assigned file id -- should succeed
echoc $LT_BLUE "Creating directory with auto-assigned file id"
eos-test-dir-inject --path ${CASTOR_PREFIX}/my_test_dir >${TMPFILE}
[ $? -eq 0 ] || error "Creating directory with auto-assigned file id failed"
json-pretty-print.sh ${TMPFILE}
rm ${TMPFILE}
eos ls -l ${EOS_PREFIX}
eos fileinfo ${EOS_PREFIX}/my_test_dir
eos rmdir ${EOS_PREFIX}/my_test_dir
# Create directory with self-assigned file id -- should succeed
echoc $LT_BLUE "Creating directory with self-assigned file id"
eos-test-dir-inject --fileid 9876543210 --path ${CASTOR_PREFIX}/my_test_dir >${TMPFILE}
[ $? -eq 0 ] || error "Creating directory with self-assigned file id failed"
json-pretty-print.sh ${TMPFILE}
rm ${TMPFILE}
eos fileinfo ${EOS_PREFIX}/my_test_dir
# Try again -- should fail
echoc $LT_GREEN "Creating directory with the same file id (should fail)"
eos-test-dir-inject --fileid 9876543210 --path ${CASTOR_PREFIX}/my_test_dir2 >/dev/null
[ $? -ne 0 ] || error "Creating directory with self-assigned file id succeeded when it should have failed"
# Remove and try again -- should succeed after restarting EOS
echoc $LT_GREEN "Remove the directory and restart EOS to remove the tombstone"
eos rmdir ${EOS_PREFIX}/my_test_dir
echoc $LT_BLUE "Recreate the directory with self-assigned file id (should succeed this time)"
eos-test-dir-inject --fileid 9876543210 --path ${CASTOR_PREFIX}/my_test_dir >/dev/null
[ $? -eq 0 ] || error "Creating directory with self-assigned file id failed with error $?"
eos fileinfo ${EOS_PREFIX}/my_test_dir
echoc $LT_GREEN "Cleaning up: removing tombstones and removing injected directories"
eos rmdir ${EOS_PREFIX}/my_test_dir 2>/dev/null
eos rmdir ${EOS_PREFIX}/my_test_dir2 2>/dev/null
#!/bin/bash
usage() { cat <<EOF 1>&2
Usage: $0 -n <namespace>
EOF
exit 1
}
while getopts "n:" o; do
case "${o}" in
n)
NAMESPACE=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${NAMESPACE}" ]; then
usage
fi
if [ ! -z "${error}" ]; then
echo -e "ERROR:\n${error}"
exit 1
fi
echo "Preparing namespace for the tests"
./prepare_tests.sh -n ${NAMESPACE}
if [ $? -ne 0 ]; then
echo "ERROR: failed to prepare namespace for the tests"
exit 1
fi
echo
echo "Launching grpc_dir_inject.sh on client pod"
kubectl -n ${NAMESPACE} cp grpc_dir_inject.sh client:/root/grpc_dir_inject.sh
kubectl -n ${NAMESPACE} exec client -- bash /root/grpc_dir_inject.sh || exit 1
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment