Skip to content

Commit 8ba7676

Browse files
author
Thierry RAMORASOAVINA
committed
Add an integration test for the incompatible major version case
- Khiops 10 is installed in a dedicated conda environment for this purpose
1 parent 559d38e commit 8ba7676

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,29 @@ jobs:
445445
fi
446446
447447
# Print status
448-
python -c \
449-
"import sys; import khiops.core as kh; return_code = kh.get_runner().print_status(); sys.exit(return_code)"
450-
RETCODE=$?
448+
PATTERN=$(python -c \
449+
"import sys; import khiops.core as kh; return_code = kh.get_runner().print_status(); sys.exit(return_code)" 2> >(grep -Ei 'with.*?unknown.*?installer') )
451450
# The installation status check will fail
452451
# because the library was not installed properly (the source code was only cloned)
453-
if [ $RETCODE -ne 0 ]; then
452+
if [ -n "$PATTERN" ]; then
454453
echo "::error::Status error: improper setup, as expected: khiops-python has been cloned, not installed from a package"
455454
fi
456455
457-
# Run integration tests on Ubuntu and Rocky
456+
# Run the library against an incompatible Khiops (with a different major version)
457+
# This instance of Khiops is isolated in a dedicated conda environment
458+
CONDA="/root/miniforge3/bin/conda"
459+
# Check an error is raised because of the major version mismatch
460+
# The khiops-python library from the cloned sources is used here
461+
PATTERN=$($CONDA run -n py3_khiops10_conda python -c "import khiops.core as kh; print(kh.get_runner().khiops_version)" 2> >(grep -Ei 'major version.*?does not match'))
462+
if [ -z "$PATTERN" ]; then
463+
echo "::error::Status error: khiops-python should fail because of the major version mismatch"
464+
if [[ "${{ matrix.container }}" == "debian13" ]]; then
465+
deactivate
466+
fi
467+
exit 1;
468+
fi
469+
470+
# Run the remaining integration tests
458471
python -m unittest -v tests.test_khiops_integrations
459472
460473
# Execute Khiops sample (train and deploy model), which uses MPI

packaging/docker/khiopspydev/Dockerfile.debian

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ RUN true \
7474
$CONDA install -y -n py${version}_conda \
7575
khiops-driver-s3==${KHIOPS_S3_DRIVER_REVISION} \
7676
khiops-driver-gcs==${KHIOPS_GCS_DRIVER_REVISION}; \
77-
done' \
77+
done; \
78+
# Install Khiops from a different major version in a dedicated conda environment \
79+
# The python interpreter version of the base environment is used as no specific version is given \
80+
$CONDA create -y -n py3_khiops10_conda; \
81+
$CONDA install -y -n py3_khiops10_conda khiops::khiops-core==10.3.1; \
82+
' \
7883
&& true
7984

8085
RUN mkdir -p /scripts

packaging/docker/khiopspydev/Dockerfile.rocky

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ RUN true \
8787
do \
8888
$CONDA create -y -n $CONDA_ENV python=${version}; \
8989
done; \
90-
$CONDA install -y -n py${version}_conda ${RC_LABEL}khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
91-
done' \
90+
$CONDA install -y -n py${version}_conda ${RC_LABEL}khiops-core==$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
91+
done; \
92+
# Install Khiops from a different major version in a dedicated conda environment \
93+
# The python interpreter version of the base environment is used as no specific version is given \
94+
$CONDA create -y -n py3_khiops10_conda; \
95+
$CONDA install -y -n py3_khiops10_conda khiops::khiops-core==10.3.1; \
96+
' \
9297
&& true
9398

9499
RUN mkdir -p /scripts

packaging/docker/khiopspydev/Dockerfile.ubuntu

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ RUN true \
7272
$CONDA install -y -n py${version}_conda \
7373
khiops-driver-s3==${KHIOPS_S3_DRIVER_REVISION} \
7474
khiops-driver-gcs==${KHIOPS_GCS_DRIVER_REVISION}; \
75-
done' \
75+
done; \
76+
# Install Khiops from a different major version in a dedicated conda environment \
77+
# The python interpreter version of the base environment is used as no specific version is given \
78+
$CONDA create -y -n py3_khiops10_conda; \
79+
$CONDA install -y -n py3_khiops10_conda khiops::khiops-core==10.3.1; \
80+
' \
7681
&& true
7782

7883
RUN mkdir -p /scripts

0 commit comments

Comments
 (0)