Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#19: move slc notebook to repo ai lab #300

Merged
merged 39 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ba0e205
#19: Moved SLC notebook to repo ai-lab
tomuben Jun 17, 2024
0fe88c3
Implemented SLC UI
tomuben Jun 19, 2024
eee155a
continued implementation
tomuben Jun 20, 2024
894a2a1
Continued implementation
tomuben Jun 21, 2024
076a3b6
Continued implementation
tomuben Jun 21, 2024
d6a5e82
Continued implementation
tomuben Jun 21, 2024
37ea024
Continued implementation
tomuben Jun 21, 2024
d58c936
Fixes
tomuben Jul 9, 2024
70bb5c3
[run-notebook-tests]
tomuben Jul 10, 2024
62349e8
Update developer guide
ckunki Jul 12, 2024
e4978b7
Added notebook test
tomuben Jul 12, 2024
d5e8cb6
Two notebook tests:
tomuben Jul 12, 2024
db0c751
Polished testing.md
tomuben Jul 12, 2024
bc88d3e
Fixed typing error
tomuben Jul 12, 2024
71a24f8
[CodeBuild]
tomuben Jul 15, 2024
1af6344
Fixes from review
tomuben Jul 15, 2024
d43491f
[CodeBuild]
tomuben Jul 15, 2024
aff8141
Split up
tomuben Jul 15, 2024
638a4c1
Fixed nb test
tomuben Jul 15, 2024
3266d3a
Added an "advanced" notebook.
tomuben Jul 16, 2024
645f293
1. Fixed test_slc.ipynb
tomuben Jul 16, 2024
1f5425a
Fixed some findings from review
tomuben Jul 16, 2024
ebe5a77
Fixed some findings from review
tomuben Jul 17, 2024
210fd99
Added more explanation about what a build step actually is.
tomuben Jul 17, 2024
60263a1
Fixes from review:
tomuben Jul 17, 2024
9741aac
Fixed comments
tomuben Jul 18, 2024
d5006c2
Fixes from Torsten's review:
tomuben Jul 18, 2024
d26396e
Fixes for schema and comment about how to use generate-language-activ…
tomuben Jul 18, 2024
df65cd3
Use test alias
tomuben Jul 18, 2024
8a734f5
removed storage of slc alias test value in secret store for nb test
tomuben Jul 19, 2024
731c829
Reverted dependency to dev branch in NB connector
tomuben Jul 19, 2024
a786cb7
[CodeBuild]
tomuben Jul 19, 2024
885272b
Updated changelog
tomuben Jul 22, 2024
d19bcaa
[CodeBuild]
tomuben Jul 22, 2024
7c3c4d7
Added a check for SaaS backend.
tomuben Jul 22, 2024
69d4ee7
[CodeBuild]
tomuben Jul 22, 2024
481164c
[CodeBuild]
tomuben Jul 22, 2024
d245d49
Fixes from Chunki's review.
tomuben Jul 22, 2024
9988a0e
[CodeBuild]
tomuben Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/changes_2.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Version: 2.1.0

* 277 Added the SaaS database parameters to the configuration page.
* 279 Made the notebooks tests running in SaaS as well as in the Docker-DB.
* 19 Added SLC notebook

## Security

Expand Down
65 changes: 48 additions & 17 deletions doc/developer_guide/testing.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,82 @@
### Tests
# Tests

XAL comes with a number of tests in directory `test`.
Besides, unit and integrations tests in the respective directories
there are tests in directory `codebuild`, see [Executing AWS CodeBuild](ci.md#executing-aws-codebuild).
XAIL comes with a number of tests in the directory `test`. Besides, unit and integration tests in the respective directories, there are tests in the directory `codebuild`, see [Executing AWS CodeBuild](ci.md#executing-aws-codebuild).

# Speeding up Docker-based Tests
## Speeding up Docker-based Tests

Creating a docker image is quite time-consuming, currently around 7 minutes. In order to use an existing
docker image in the tests in `integration/test_create_dss_docker_image.py`
simply add CLI option `--dss-docker-image` when calling `pytest`:
Creating a docker image is quite time-consuming, currently around 7 minutes.

To get test results faster, you can use an existing Docker image. You can create such an image using the [CLI command](commands.md#release-commands) `create-docker-image` or run your tests once with an additional CLI option `--keep-dss-docker-image` to keep the image rather than removing it after the test session.

Sample usage of the command `create-docker-image`:
```shell
poetry run exasol/ds/sandbox/main.py \
create-docker-image \
--version 9.9.9 \
--log-level info
```

To use an existing docker image in the tests in `integration/test_create_dss_docker_image.py`, simply add the CLI option `--dss-docker-image` when calling `pytest`:

```shell
poetry run pytest --dss-docker-image exasol/ai-lab:2.1.0
```

#### Executing tests involving AWS resources
## Tests for Jupyter Notebooks

The AI-Lab also contains end-to-end tests for Jupyter notebooks. Executing these tests can take several hours, currently ~3h.

The notebook tests are based on a common parameterized [test-runner](../../test/notebook_test_runner/test_notebooks_in_dss_docker_image.py). The test-runner contains a single parameterized test case on the outer level. Each time the test is executed, the test is parameterized with a Python file from the directory [test/notebooks](../../test/notebooks/) containing the particular test cases for one of the Jupyter notebooks.

The outer test case then uses a session-scoped fixture for creating an ordinary AI-Lab Docker image. Another session-scoped fixture adds some packages for executing the notebook tests, resulting in a second Docker image. Finally, the test-runner launches a Docker container from the second image and runs the inner test cases for the current notebook inside the Docker container.

In total, the following Docker entities are involved:
* Docker image 1 of the AI-Lab
* Docker image 2 for running the inner notebook tests
* Docker container running Docker image 2

In AWS web interface, IAM create an access key for CLI usage and save or download the *access key id* and the *secret access key*.
### Speeding up Notebook Tests

In file `~/.aws/config` add lines
You can speed up the notebook tests using the [same strategy](#speeding-up-docker-based-tests) as for tests involving the basic Docker image for the AI-Lab.

The CLI option to keep the image is `--keep-docker-image-notebook-test`, the option for using an existing Docker image for executing the notebook tests is `--docker-image-notebook-test`.

```shell
poetry run pytest --docker-image-notebook-test <name:version>
```

## Executing Tests Involving AWS Resources

In the AWS web interface, IAM create an access key for CLI usage and save or download the *access key id* and the *secret access key*.

In the file `~/.aws/config`, add lines:

```
[profile dss_aws_tests]
region = eu-central-1
```

In file `~/.aws/credentials` add
In the file `~/.aws/credentials`, add:

```
[dss_aws_tests]
aws_access_key_id=...
aws_secret_access_key=...
```

In case your are using MFA authentication please allocate a temporary token.
In case you are using MFA authentication, please allocate a temporary token.

After that you can set an environment variable and execute the tests involving AWS resources:
After that, you can set an environment variable and execute the tests involving AWS resources:

```shell
export AWS_PROFILE=dss_aws_tests_mfa
poetry run pytest test/test_deploy_codebuild.py
```

#### Executing tests involving Ansible
## Executing Tests Involving Ansible

For making pytest display Ansible log messages, please use
To make pytest display Ansible log messages, please use:

```shell
poetry run pytest -s -o log_cli=true -o log_cli_level=INFO
```
```
Loading