Skip to content

Commit

Permalink
Split tests to S2I and NOS2I
Browse files Browse the repository at this point in the history
Add script to cleaning dirs before running tests

Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Oct 2, 2024
1 parent 233b6bf commit da3be00
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
23 changes: 15 additions & 8 deletions daily_tests/daily_scl_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ set -x
SCL_CONTAINERS_UPSTREAM="\
s2i-nodejs-container
"
SCL_CONTAINERS="\

SCL_S2I_CONTAINERS="\
s2i-base-container
s2i-nodejs-container
s2i-php-container
s2i-perl-container
s2i-ruby-container
s2i-python-container
"

SCL_NOS2I_CONTAINTERS="\
varnish-container
nginx-container
httpd-container
Expand All @@ -26,7 +30,12 @@ TARGET="$1"
shift
[[ -z "$1" ]] && { echo "You have to specify type of the test to run. test, test-openshift, test-openshift-pytest, test-openshift-4" && exit 1 ; }
TESTS="$1"

shift
SET_TEST=""
if [[ "${TESTS}" != "test-upstream" ]]; then
[[ -z "$1" ]] && { echo "You have to specify type of images S2I or NOS2I" && exit 1 ; }
SET_TEST="$1"
fi
CUR_WD=$(pwd)
echo "Current working directory is: ${CUR_WD}"

Expand All @@ -37,11 +46,6 @@ KUBEPASSWD=/root/.kube/ocp-kube

mkdir -p "${RESULT_DIR}"

function start_ocp3() {
cd /root/container-common-scripts || exit 1
bash test-lib-openshift.sh ct_os_cluster_up
}

function clone_repo() {
local repo_name=$1; shift
# Sometimes cloning failed with an error
Expand Down Expand Up @@ -69,11 +73,14 @@ function clean_ocp4() {
}

function iterate_over_all_containers() {
CONTAINTERS_TO_TEST=$SCL_CONTAINERS
CONTAINTERS_TO_TEST=$SCL_S2I_CONTAINERS
if [[ "${TESTS}" == "test-upstream" ]]; then
CONTAINTERS_TO_TEST=$SCL_CONTAINERS_UPSTREAM
elif [[ "${SET_TEST}" == "NOS2I" ]]; then
CONTAINTERS_TO_TEST=$SCL_NOS2I_CONTAINTERS
fi


for repo in ${CONTAINTERS_TO_TEST}; do
# Do not shutting down OpenShift 3 cluster
export OS_CLUSTER_STARTED_BY_TEST=0
Expand Down
19 changes: 19 additions & 0 deletions prepare_machine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -x

LOGS_DIR="/home/fedora/logs"
DAILY_TEST_DIR="/var/tmp/daily_scl_tests"
WORK_DIR=$(mktemp -d -p "/var/tmp")

if [ -d "${DAILY_TEST_DIR}" ]; then
rm -rf "${DAILY_TEST_DIR}"
fi

if [ -d "${WORK_DIR}" ]; then
rm -rf "${WORK_DIR}"
fi

if [ -d "${LOGS_DIR}" ]; then
rm -rf "${LOGS_DIR}"
fi
7 changes: 2 additions & 5 deletions run_nightly_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [[ "$TARGET" == "rhel8" ]]; then
elif [[ "$TARGET" == "rhel9" ]]; then
COMPOSE="1MT-RHEL-9.4.0-updates"
elif [[ "$TARGET" == "fedora" ]]; then
COMPOSE="1MT-Fedora-39"
COMPOSE="1MT-Fedora-41"
TMT_REPO="https://github.com/sclorg/sclorg-testing-farm"
TMT_DIR="sclorg-testing-farm"
TFT_PLAN="nightly-container-f"
Expand Down Expand Up @@ -57,10 +57,7 @@ if [[ ! -d "${LOGS_DIR}" ]]; then
mkdir -p "${LOGS_DIR}"
fi
COMPOSE=$(tmt -q run provision -h minute --list-images | grep $COMPOSE | head -n 1 | tr -d '[:space:]')
echo "COMPOSE is $COMPOSE" | tee -a ${LOG}
if [ -d "${DAILY_TEST_DIR}/${TARGET}-$TESTS" ]; then
rm -rf "${DAILY_TEST_DIR}/${TARGET}-$TESTS"
fi

mkdir -p "${DAILY_TEST_DIR}/${TARGET}-$TESTS"
LOG="${LOGS_DIR}/$TARGET-$TESTS.log"
date > "${LOG}"
Expand Down

0 comments on commit da3be00

Please sign in to comment.