Integration Tests¶
MLFP integration tests automatically provision the following prerequisites via fixtures:
Run a Docker instance of Exasol for accessing the BucketFS
Build a Script Language Container (SLC)
Run an MLflow server
As these steps can be quite time-consuming, there are options to skip these steps and reuse artifacts and services already provided on your local machine.
Reusing an Existing Database¶
For reusing an existing database you can use the following pytest CLI options:
pytest \
--backend=onprem \
--itde-db-version=external \
--bucketfs-url https://127.0.0.1:2581 \
--bucketfs-password "$BUCKETFS_PASSWORD"
CLI option --bucketfs-url is required for uploading the SLC.
See also Pytest Plugin Exasol-Backend.
Using the Deployed SLC Interactively¶
Some integration tests are using the fixture deployed_slc for building and
deploying an SLC and activating it by setting a language alias. As the script
language is activated for the system and is not removed after the tests, you
can happily create UDFs using your SLC after one of these tests has been
executed.
The tests define the alias by means of Pytest fixture language_alias:
@pytest.fixture(scope="session")
def language_alias(request):
"""See developer guide for details."""
return request.config.getoption("--language-alias") or "MLFLOW"
Reuse SLC¶
For skipping building and deploying the SLC you can add option
--skip-slc. If you have installed the SLC already you can reuse it by
adding pytest CLI option --language-alias MLFLOW.
Reusing the MLflow Server¶
For reusing an already running instance of MLflow server you can add option
--mlflow-server:
pytest --mlflow-server http://localhost:5000
MLflow Tracking URI in UDFs¶
Please note when running Exasol Docker-DB in a virtual machine, UDFs cannot
access the MLflow server via localhost, but only via the default gateway
of the virtual machine.
When using a Lima VM, you can retrieve the IP address with the following command:
function vmip() {
limactl shell default ip route show match default | awk '{print $3}'
}
Here is a complete example:
pytest \
--skip-slc --backend onprem --itde-db-version external \
--bucketfs-password "$BUCKETFS_PASSWORD" \
--mlflow-server http://$(vmip):5000 --language-alias MLFLOW \
test/integration/with_mlflow_server/test_udfs.py
Database Schema¶
Pytest fixture db_schema_name defines the default database schema for the
integration tests:
@pytest.fixture(scope="session")
def db_schema_name(request) -> str:
return request.config.getoption("--db-schema") or "ITEST_MLFLOW"
You can specify an individual database schema with Pytest
CLI option --db-schema:
pytest --db-schema MLFLOW_REST_API
Keeping the Database Schema¶
Usually the database schema will be dropped after finishing the integration tests, but it will be kept, if it already existed before starting the tests. This enables you to inspect all the artifacts created by the tests incl. the UDFs.