THIS IS ONLY A TEST INSTANCE. DON'T DO IMPORTANT WORK HERE!

Unverified Commit 8d85dc10 authored by Flavius Lacatusu's avatar Flavius Lacatusu
Browse files

Add logger to the e2e automation script locally


Signed-off-by: default avatarFlavius Lacatusu <flacatus@redhat.com>
parent b8ea0bb2
......@@ -9,7 +9,7 @@
# Contributors:
# Red Hat, Inc. - initial API and implementation
set -e -x
set -e
installStartDocker() {
if [ -x "$(command -v docker)" ]; then
......@@ -26,7 +26,6 @@ installStartDocker() {
install_required_packages() {
# Install EPEL repo
yum -y install epel-release
# Get all the deps in
yum -y install libvirt qemu-kvm
echo '[INFO]CICO: Required virtualization packages installed'
......
......@@ -11,7 +11,7 @@
# Red Hat, Inc. - initial API and implementation
# Exit on error
set -e -x
set -e
trap 'Catch_Finish $?' EXIT SIGINT
......@@ -21,6 +21,19 @@ Catch_Finish() {
rm -rf ${OPERATOR_REPO}/tmp
}
#TODO! Move this utilities to another folder
printInfo() {
green=`tput setaf 2`
reset=`tput sgr0`
echo "${green}[INFO]: ${1} ${reset}"
}
printError() {
red=`tput setaf 1`
reset=`tput sgr0`
echo "${red}[ERROR]: ${1} ${reset}"
}
init() {
MSFT_RELEASE="1.34.2"
GO_TOOLSET_VERSION="1.11.5-3"
......@@ -30,6 +43,15 @@ init() {
}
eval_minishift_env() {
if ! [ -x "$(command -v minsishift)" ]; then
printError 'Minishift is not installed.Please install minishift following the instructions: https://docs.okd.io/latest/minishift/getting-started/installing.html' >&2
exit 1
fi
if [[ ! $(ps axf | grep minishift | grep -v grep) ]]; then
printError "Minishift is not running. Please start minishift to be available to run e2e tests!"
exit 1
fi
eval $(minishift oc-env)
oc login -u system:admin
oc adm policy add-cluster-role-to-user cluster-admin developer && oc login -u developer -p developer
......@@ -37,12 +59,12 @@ eval_minishift_env() {
oc_tls_mode() {
# generate self signed cert
echo "[INFO] Generate self signed certificate"
printInfo "Generate self signed certificate"
cd $OPERATOR_REPO/tmp && generate_self_signed_certs # replace default router cert
echo "[INFO] Update OpenShift router tls secret"
printInfo "Update OpenShift router tls secret"
oc project default
oc secrets new router-certs tls.crt=ca.crt tls.key=key.pem -o json --type='kubernetes.io/tls' --confirm | oc replace -f -
echo "[INFO] Initiate a new router deployment"
printInfo "Initiate a new router deployment"
sleep 20
oc rollout latest dc/router -n=default || true
}
......@@ -50,24 +72,25 @@ oc_tls_mode() {
run_tests() {
if [ ! -d "$OPERATOR_REPO/tmp" ]; then mkdir -p "$OPERATOR_REPO/tmp" && chmod 777 "$OPERATOR_REPO/tmp"; fi
eval_minishift_env
echo "[INFO] Register a custom resource definition"
printInfo "Register a custom resource definition"
oc apply -f ${OPERATOR_REPO}/deploy/crds/org_v1_che_crd.yaml
oc_tls_mode
echo "[INFO] Compile tests binary"
printInfo "Compile tests binary"
docker run -t \
-v ${OPERATOR_REPO}/tmp:/operator \
-v ${OPERATOR_REPO}:/opt/app-root/src/go/src/github.com/eclipse/che-operator registry.access.redhat.com/devtools/go-toolset-rhel7:${GO_TOOLSET_VERSION} \
sh -c "OOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /operator/run-tests /opt/app-root/src/go/src/github.com/eclipse/che-operator/e2e/*.go"
echo "[INFO] Build operator docker image and load in to minishift VM..."
printInfo "Build operator docker image and load in to minishift VM..."
cd ${OPERATOR_REPO} && docker build -t che/operator -f Dockerfile . && docker save che/operator > operator.tar
eval $(minishift docker-env) && docker load -i operator.tar && rm operator.tar
echo "[INFO] Run tests..."
printInfo "Run tests..."
${OPERATOR_REPO}/tmp/run-tests
}
init
run_tests
#TODO avoid the use of cd on shell...
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment