Skip to content

Commit

Permalink
#151: Setup SageMaker Credentials for notebook testing in the CI (#153)
Browse files Browse the repository at this point in the history
* Moved test_notebooks_in_dss_docker_image.py and the docker test tooling into their own top-level test directory, such that we can address it independently of the other integration tests.

* Added SageMaker secrets to check_ci.yaml and split it into two jobs one for testing notebooks and one for testing building the ai-lab.

* Fix imports

* Move dss_docker_image from conftest to own module and registered it as plugin in the main conftest

* Update changelog
  • Loading branch information
tkilias authored Jan 31, 2024
1 parent 372172c commit 0eb07f1
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 8 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/check_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "main"

jobs:
run_ci_tests:
run_build_ai_lab_tests:
environment: AWS_CI_TESTS
runs-on: ubuntu-latest

Expand All @@ -17,7 +17,7 @@ jobs:
- name: Setup Python & Poetry Environment
uses: ./.github/actions/prepare_poetry_env

- name: Run pytest
- name: Run build ai-lab tests
run: >
poetry run pytest
--capture=no
Expand All @@ -29,3 +29,26 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

run_nodebook_tests:
environment: AWS_SAGEMAKER
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python & Poetry Environment
uses: ./.github/actions/prepare_poetry_env

- name: Run notebook tests
run: >
poetry run pytest
--capture=no
--override-ini=log_cli=true
--override-ini=log_cli_level=INFO
test/notebook_test_runner/test_notebooks_in_dss_docker_image.py
env: # Set the secret as an env variable
NBTEST_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
NBTEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET }}
NBTEST_AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
4 changes: 3 additions & 1 deletion doc/changes/changes_0.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ Version: 0.1.0
* #76: Added display of usage instructions for AI-Lab Docker edition
* #137: Set Jupyter lab default URL to AI-Lab start page
* #75: Changed default port of Jupyter server to 49494
* #145: Add Docket Test Library to prepare Notebook tests
* #145: Add Docker Test Library to prepare Notebook tests
* #255: Renamed data science sandbox to exasol-ai-lab
* #145: Added Docker Test Library to prepare Notebook tests
* #151: Setup SageMaker Credentials for notebook testing in the CI

## Bug Fixes

Expand Down
5 changes: 4 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

TEST_DUMMY_AMI_ID = "ami-123"

pytest_plugins = (
"test.docker.dss_docker_image",
)


@pytest.fixture
def default_asset_id():
Expand All @@ -30,7 +34,6 @@ def jupyter_port():

@pytest.fixture
def ec2_cloudformation_yml():

return render_template("ec2_cloudformation.jinja.yaml", key_name="test_key", user_name="test_user",
trace_tag=DEFAULT_TAG_KEY, trace_tag_value=DEFAULT_ASSET_ID.tag_value,
ami_id=TEST_DUMMY_AMI_ID)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import pytest

from test.integration.docker.exec_run import exec_command
from test.integration.docker.image import image
from test.integration.docker.in_memory_build_context import InMemoryBuildContext
from test.integration.docker.container import container
from test.docker.exec_run import exec_command
from test.docker.image import image
from test.docker.in_memory_build_context import InMemoryBuildContext
from test.docker.container import container

TEST_RESOURCE_PATH = Path(__file__).parent.parent / "notebooks"

Expand Down

0 comments on commit 0eb07f1

Please sign in to comment.