Repository: exasol/integration-test-docker-environment (language: python)

Issue:
Add test to verify UDF execution and fix EXAConf template for 8.18.1
Docker image for latest version 8.18.1 of Exasol database includes the change to a rootless container technology which causes UDF execution to result in error "VM crashed".

Up to now the existing test cases in ITDE did not verify successful UDF execution.

The current ticket therefore requests to add such a test and fix the template for file EXAConf for version 8.18.1.

### AC

```[tasklist]
### AC
- [x] test to verify UDF execution is added
- [x] EXAConf template for 8.18.1 is fixed
```



Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index a2ac499c2..de6dcef13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ Pipfile.lock
 .build_output/
 dist/
 .vagrant
+TAGS
diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md
index 2901fac12..b076147ad 100644
--- a/doc/changes/changelog.md
+++ b/doc/changes/changelog.md
@@ -1,5 +1,6 @@
 # Changes
 
+* [1.7.1](changes_1.7.1.md)
 * [1.7.0](changes_1.7.0.md)
 * [1.6.0](changes_1.6.0.md)
 * [1.5.0](changes_1.5.0.md)
@@ -27,6 +28,7 @@
 ---
 hidden:
 ---
+changes_1.7.1
 changes_1.7.0
 changes_1.6.0
 changes_1.5.0
diff --git a/doc/changes/changes_1.7.1.md b/doc/changes/changes_1.7.1.md
new file mode 100644
index 000000000..6224ab98f
--- /dev/null
+++ b/doc/changes/changes_1.7.1.md
@@ -0,0 +1,19 @@
+# Integration-Test-Docker-Environment 1.7.1, released 2023-06-19
+
+## Summary
+
+This release fixes the not working UDFs in Exasol Docker-DB 8.18.1. 
+
+### Supported Exasol Versions
+
+* **7.0**: up to 7.0.20, **except 7.0.5**
+* **7.1**: up to 7.1.17
+* **8**: 8.18.1
+
+If you need further versions, please open an issue.
+
+## Internal
+
+## Changes
+
+* #351: Added test for UDF with builtin Script-Language Container and fixed it for Docker-DB 8.18.1
\ No newline at end of file
diff --git a/docker_db_config_template/8.18.1/EXAConf b/docker_db_config_template/8.18.1/EXAConf
index e09327fa5..c5e023294 100644
--- a/docker_db_config_template/8.18.1/EXAConf
+++ b/docker_db_config_template/8.18.1/EXAConf
@@ -171,7 +171,9 @@
     BuiltinScriptLanguageName = slc-6.0.0-c4-5-standard-EXASOL-8.0.0/ScriptLanguages-standard-EXASOL-8.0.0-slc-v6.0.0-PB5EHDLN
     AutoStart = True
     {% if additional_db_parameters %}
-    Params = {{ additional_db_parameters }}
+    Params = -sandboxCHROOT=/opt/exasol/cos-8.29.2/sbin/nsexec_chroot {{ additional_db_parameters }}
+    {% else %}
+    Params = -sandboxCHROOT=/opt/exasol/cos-8.29.2/sbin/nsexec_chroot
     {% endif %}
 
     # JDBC driver configuration
diff --git a/poetry.lock b/poetry.lock
index bfb6cc4e5..68b819c26 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -647,14 +647,14 @@ files = [
 
 [[package]]
 name = "invoke"
-version = "2.1.2"
+version = "2.1.3"
 description = "Pythonic task execution"
 category = "main"
 optional = false
 python-versions = ">=3.6"
 files = [
-    {file = "invoke-2.1.2-py3-none-any.whl", hash = "sha256:bfc904df1c9e9fe1a881933de661fe054b8db616ff2c4cf78e00407fe473ba5d"},
-    {file = "invoke-2.1.2.tar.gz", hash = "sha256:a6cc1f06f75bacd0b1e11488fa3bf3e62f85e31f62e2c0172188613ba5b070e2"},
+    {file = "invoke-2.1.3-py3-none-any.whl", hash = "sha256:51e86a08d964160e01c44eccd22f50b25842bd96a9c63c11177032594cb86740"},
+    {file = "invoke-2.1.3.tar.gz", hash = "sha256:a3b15d52d50bbabd851b8a39582c772180b614000fa1612b4d92484d54d38c6b"},
 ]
 
 [[package]]
diff --git a/pyproject.toml b/pyproject.toml
index 6b4bfffd2..08aa34cb7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ packages = [
     { include = "exasol_integration_test_docker_environment" },
     { include = "pytest_itde" }
 ]
-version = "1.7.0"
+version = "1.7.1"
 description = "Integration Test Docker Environment for Exasol"
 
 license = "MIT"


Test patch:
diff --git a/exasol_integration_test_docker_environment/docker_db_config/8.18.1/EXAConf b/exasol_integration_test_docker_environment/docker_db_config/8.18.1/EXAConf
index e09327fa5..c5e023294 100644
--- a/exasol_integration_test_docker_environment/docker_db_config/8.18.1/EXAConf
+++ b/exasol_integration_test_docker_environment/docker_db_config/8.18.1/EXAConf
@@ -171,7 +171,9 @@
     BuiltinScriptLanguageName = slc-6.0.0-c4-5-standard-EXASOL-8.0.0/ScriptLanguages-standard-EXASOL-8.0.0-slc-v6.0.0-PB5EHDLN
     AutoStart = True
     {% if additional_db_parameters %}
-    Params = {{ additional_db_parameters }}
+    Params = -sandboxCHROOT=/opt/exasol/cos-8.29.2/sbin/nsexec_chroot {{ additional_db_parameters }}
+    {% else %}
+    Params = -sandboxCHROOT=/opt/exasol/cos-8.29.2/sbin/nsexec_chroot
     {% endif %}
 
     # JDBC driver configuration
diff --git a/test/integration/test_udf_execution.py b/test/integration/test_udf_execution.py
new file mode 100644
index 000000000..5997e19e3
--- /dev/null
+++ b/test/integration/test_udf_execution.py
@@ -0,0 +1,38 @@
+import pyexasol
+
+from inspect import cleandoc
+from time import sleep
+
+from exasol_integration_test_docker_environment.lib.test_environment.db_version import DbVersion
+
+
+def test_udf_execution(api_database):
+    def wait_until_container_is_unpacked():
+        sleep(5 * 60)
+
+    def udf_sql(schema: str) -> str:
+        return cleandoc(
+            f"""
+            --/
+            CREATE OR REPLACE PYTHON3 SCALAR SCRIPT
+              {schema}.python3_test_udf(count INT)
+              EMITS (outp INT) AS
+            import os
+
+            def run(ctx):
+                for i in range(ctx.count):
+                    ctx.emit(i)
+            /
+            """
+        )
+
+    with api_database() as db:
+        dbinfo = db.environment_info.database_info
+        dsn = f"{dbinfo.host}:{dbinfo.db_port}"
+        connection = pyexasol.connect(dsn=dsn, user="sys", password="exasol")
+        if DbVersion.from_db_version_str(db.docker_db_image_version).major == 7:
+            wait_until_container_is_unpacked()
+        connection.execute("CREATE SCHEMA IF NOT EXISTS S")
+        connection.execute(udf_sql(schema="S"))
+        result = connection.execute("SELECT S.python3_test_udf(10)").fetchall()
+        assert result == [(i,) for i in range(10)]