Skip to content

Commit

Permalink
Tests: merge before_script.sh into install_script.sh
Browse files Browse the repository at this point in the history
The content is now small enough that it doesn't justify having a
separate script. The only tricky part was configuration of the
oracle database. Luckily, the container which we use already supports
mounting a shell script to be executed on initialization. It's enough
to mount it at the correct location.
  • Loading branch information
Radu Carpa committed Oct 11, 2023
1 parent 1bc53ae commit b0d74e0
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 109 deletions.
2 changes: 2 additions & 0 deletions etc/docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ services:
- processes=1000
- sessions=1105
- transactions=1215
volumes:
- ../../../tools/test/oracle_setup.sh:/container-entrypoint-initdb.d/oracle_setup.sh:Z
fts:
image: docker.io/rucio/fts
profiles:
Expand Down
87 changes: 0 additions & 87 deletions tools/test/before_script.sh

This file was deleted.

54 changes: 45 additions & 9 deletions tools/test/install_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,60 @@ set -eo pipefail

echo "* Using $(command -v python) $(python --version 2>&1) and $(command -v pip) $(pip --version 2>&1)"

SOURCE_PATH=/usr/local/src/rucio
CFG_PATH=/usr/local/src/rucio/etc/docker/test/extra/
RUCIO_HOME=/opt/rucio

generate_rucio_cfg(){
local override=$1
local destination=$2

python3 $SOURCE_PATH/tools/merge_rucio_configs.py \
-s $CFG_PATH/rucio_autotests_common.cfg "$override" \
--use-env \
-d "$destination"
}

if [ "$SUITE" == "client" -o "$SUITE" == "client_syntax" ]; then
cd /usr/local/src/rucio
cd $SOURCE_PATH
cp etc/docker/test/extra/rucio_client.cfg etc/rucio.cfg

elif [ "$SUITE" == "syntax" -o "$SUITE" == "docs" ]; then
cd /usr/local/src/rucio
python3 tools/merge_rucio_configs.py \
-s etc/docker/test/extra/rucio_autotests_common.cfg \
etc/docker/test/extra/rucio_syntax.cfg \
--use-env \
-d etc/rucio.cfg
generate_rucio_cfg "$CFG_PATH"/rucio_syntax.cfg "$SOURCE_PATH"/etc/rucio.cfg

elif [ "$SUITE" == "votest" ]; then
RUCIO_HOME=/opt/rucio
VOTEST_HELPER=$RUCIO_HOME/tools/test/votest_helper.py
VOTEST_CONFIG_FILE=$RUCIO_HOME/etc/docker/test/matrix_policy_package_tests.yml
echo "VOTEST: Overriding policy section in rucio.cfg"
python $VOTEST_HELPER --vo $POLICY --vo-config --file $VOTEST_CONFIG_FILE
echo "VOTEST: Restarting httpd to load config"
httpd -k restart
fi

elif [ "$SUITE" == "remote_dbs" ] || [ "$SUITE" == "multi_vo" ]; then

if [ $RDBMS == "oracle" ]; then
generate_rucio_cfg $CFG_PATH/rucio_oracle.cfg $RUCIO_HOME/etc/rucio.cfg
cp $CFG_PATH/alembic_oracle.ini $RUCIO_HOME/etc/alembic.ini

elif [ $RDBMS == "mysql8" ]; then
generate_rucio_cfg $CFG_PATH/rucio_mysql8.cfg $RUCIO_HOME/etc/rucio.cfg
cp $CFG_PATH/alembic_mysql8.ini $RUCIO_HOME/etc/alembic.ini

elif [ $RDBMS == "postgres14" ]; then
if [ $SUITE == "multi_vo" ]; then
mkdir -p $RUCIO_HOME/etc/multi_vo/tst/etc
mkdir -p $RUCIO_HOME/etc/multi_vo/ts2/etc
generate_rucio_cfg $CFG_PATH/rucio_multi_vo_tst_postgres14.cfg $RUCIO_HOME/etc/multi_vo/tst/etc/rucio.cfg
generate_rucio_cfg $CFG_PATH/rucio_multi_vo_ts2_postgres14.cfg $RUCIO_HOME/etc/multi_vo/ts2/etc/rucio.cfg
fi
generate_rucio_cfg $CFG_PATH/rucio_postgres14.cfg $RUCIO_HOME/etc/rucio.cfg
cp $CFG_PATH/alembic_postgres14.ini $RUCIO_HOME/etc/alembic.ini
fi
httpd -k restart

elif [ "$SUITE" == "sqlite" ]; then
generate_rucio_cfg $CFG_PATH/rucio_sqlite.cfg $RUCIO_HOME/etc/rucio.cfg
cp $CFG_PATH/alembic_sqlite.ini $RUCIO_HOME/etc/alembic.ini

httpd -k restart
fi
13 changes: 0 additions & 13 deletions tools/test/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,19 +326,6 @@ def run_with_httpd(
rdbms: f'{project}_{rdbms}_1',
}

# Running before_script.sh
run(
'./tools/test/before_script.sh',
env={
**os.environ,
**caseenv,
**namespace_env,
"CONTAINER_RUNTIME_ARGS": ' '.join(namespace_args),
"CON_RUCIO": containers['rucio'],
"CON_DB": containers[rdbms],
},
)

# Running install_script.sh
run('docker', *namespace_args, 'exec', containers['rucio'], './tools/test/install_script.sh')

Expand Down

0 comments on commit b0d74e0

Please sign in to comment.