Skip to content

Commit

Permalink
CI: Run Komodo tests in the RMS environment
Browse files Browse the repository at this point in the history
Komodo CI tests will now run twice, once in the standard Komodo
environment and again in the matrix of RMS version environments.
Also tried to add a bit more clarity to file paths and `pwd` in
the script.
  • Loading branch information
mferrera committed Nov 21, 2023
1 parent 9e24f9b commit febaa33
Showing 1 changed file with 51 additions and 21 deletions.
72 changes: 51 additions & 21 deletions ci/testkomodo.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,65 @@
XTG_TEST_RUNPATH=$CI_TEST_ROOT/run

RMS_VERSIONS=(
12.1.4
13.1.2
14.1.0
)

run_tests() {
copy_test_files
start_tests
}

copy_test_files () {
mkdir $CI_TEST_ROOT/testpath/

pushd $CI_TEST_ROOT/testpath
cp -r $CI_SOURCE_ROOT/tests tests
cp -r $CI_SOURCE_ROOT/conftest.py conftest.py
ln -s $CI_SOURCE_ROOT/examples
ln -s $CI_SOURCE_ROOT/xtgeo-testdata
git clone --depth=1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata
git clone --depth=1 https://github.com/equinor/xtgeo-testdata $CI_TEST_ROOT/xtgeo-testdata
# xtgeo tests look two directories back for xtgeo-testdata
mkdir -p $XTG_TEST_RUNPATH
cp -r $CI_SOURCE_ROOT/tests $XTG_TEST_RUNPATH
ln -s $CI_SOURCE_ROOT/conftest.py $XTG_TEST_RUNPATH/conftest.py
ln -s $CI_SOURCE_ROOT/pyproject.toml $XTG_TEST_RUNPATH/pyproject.toml
}

start_tests () {
pushd $CI_TEST_ROOT
echo "Testing xtgeo against Komodo"
install_and_test
for version in ${RMS_VERSIONS[@]}; do
test_in_roxenv $version
done
popd
}

install_package () {
pip install ".[dev]"
install_and_test () {
install_package
run_pytest
}

start_tests () {
pushd $CI_TEST_ROOT/testpath
pytest -n auto -vv
install_package () {
pushd $CI_SOURCE_ROOT
pip install ".[dev]"
popd
}

cleanup () {
rm -rf $CI_TEST_ROOT/testpath/../xtgeo-testdata
run_pytest () {
pushd $XTG_TEST_RUNPATH
pytest -n 4 -vv
popd
}

run_tests() {
copy_test_files
test_in_roxenv () {
set +e
source /project/res/roxapi/aux/roxenvbash $1
# Unsetting an empty PYTHONPATH after sourcing roxenvbash
# may result in an error.
unset PYTHONPATH
set -e

install_package
python -m venv roxenv --system-site-packages

pushd $CI_TEST_ROOT
start_tests
cleanup
source roxenv/bin/activate
echo "Testing xtgeo against RMS $1"
install_and_test
deactivate
rm -rf roxenv
}

0 comments on commit febaa33

Please sign in to comment.