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

#120 Running tests in SaaS [run aws tests] #131

Merged
merged 34 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
22da227
#120 Running tests in SaaS [run aws tests]
ahsimb Jun 21, 2024
76b432a
#120 Running tests in SaaS [run aws tests]
ahsimb Jun 21, 2024
550efe6
#120 Running tests in SaaS [run aws tests]
ahsimb Jun 21, 2024
7351570
#120 Running tests in SaaS [run aws tests]
ahsimb Jun 21, 2024
a828b3f
#120 Running tests in SaaS [run aws tests]
ahsimb Jun 21, 2024
8adacaf
#120 Running tests in SaaS [run aws tests]
ahsimb Jun 21, 2024
7880a9c
#120 Refactored integration tests
ahsimb Jun 24, 2024
3f43f13
#120 Refactored integration tests
ahsimb Jun 24, 2024
2d1029c
#120 Fixed the deployment tests
ahsimb Jun 24, 2024
8fdfba8
#120 Fixed the deployment tests
ahsimb Jun 24, 2024
d25b055
#120 Added debugging
ahsimb Jun 24, 2024
99d8071
#120 Added debugging
ahsimb Jun 24, 2024
ec3fbf2
#120 Added debugging
ahsimb Jun 24, 2024
91fc32b
#120 I don't know what is wrong
ahsimb Jun 24, 2024
3808530
#120 Tried to use the newest version of the ITDE
ahsimb Jun 25, 2024
73ee2a3
#120 Fixed the db setup
ahsimb Jun 25, 2024
ee81990
#120 Fixed the arg list of the script deployer
ahsimb Jun 25, 2024
460215e
#120 Fixed the arg list of the script deployer
ahsimb Jun 25, 2024
3cb4aef
#120 All tests are enabled
ahsimb Jun 25, 2024
02d59de
#120 Moved pyexasol connect to the python-extension-common
ahsimb Jun 26, 2024
a24a46d
#120 Added the backend fixture
ahsimb Jun 26, 2024
85a8860
#120 Rolled back changes in integration tests
ahsimb Jun 27, 2024
bbcdd2e
#120 Changed arg_list creation
ahsimb Jun 27, 2024
0dff53f
#120 Changed arg_list creation
ahsimb Jun 27, 2024
94c4485
#120 Added delay after uploading SLC to SaaS
ahsimb Jun 28, 2024
e21b552
#120 Made the SaaS waiting time longer.
ahsimb Jun 28, 2024
82484a5
#120 Made the SaaS waiting time longer.
ahsimb Jul 1, 2024
da2f8a1
#120 Removed double underscore
ahsimb Jul 1, 2024
862f570
#120 Running tests in SaaS only
ahsimb Jul 1, 2024
ac81a99
#120 Enabled all tests again
ahsimb Jul 1, 2024
12e1026
#120 Disabled all tests except script deployment
ahsimb Jul 2, 2024
8b595a1
#120 Enabled all tests
ahsimb Jul 2, 2024
83b0dec
#120 Removed debugging prints
ahsimb Jul 2, 2024
2b75688
#120 Print output of the dodgy cli test before it fails
ahsimb Jul 2, 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
14 changes: 4 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,12 @@ jobs:
run: ./scripts/setup_integration_test.sh

- name: Poetry run pytest integration tests
run: poetry run pytest tests

- name: Fail, if AWS-tests are not activated
if: "!contains(github.event.head_commit.message, '[run aws tests]')"
run: |
echo "Failed, because AWS-tests are not activated"
exit 1
- name: Run AWS-tests if it is activated
if: "contains(github.event.head_commit.message, '[run aws tests]')"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ROLE: ${{ secrets.AWS_ROLE }}
AWS_DEFAULT_REGION: "eu-central-1"
run: poetry run pytest tests/ci_tests -s
SAAS_HOST: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_HOST }}
SAAS_ACCOUNT_ID: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_ACCOUNT_ID }}
SAAS_PAT: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_PAT }}
run: poetry run pytest tests
4 changes: 2 additions & 2 deletions doc/changes/changes_0.10.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SageMaker Extension 0.10.0, released 2024-06-20
# SageMaker Extension 0.10.0, T.B.D.

Code name: Python 3.10

Expand All @@ -8,7 +8,7 @@ Improving documentation, refactoring and moving to Python 3.10

### Features

n/a
- #120: Running CI tests in the SaaS as well as the Docker DB.

### Bug Fixes

Expand Down
71 changes: 57 additions & 14 deletions exasol_sagemaker_extension/deployment/deploy_cli.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,77 @@
from __future__ import annotations

import click
import logging
from exasol.python_extension_common.deployment.language_container_deployer_cli import (
SecretParams, SECRET_DISPLAY, secret_callback)

from exasol_sagemaker_extension.deployment.deploy_create_statements \
import DeployCreateStatements


@click.command()
@click.option('--host', type=str, required=True, help="db host address")
@click.option('--port', type=str, required=True, help="db host port")
@click.option('--user', type=str, required=True, help="db user name")
@click.option('--pass', 'pwd', required=True, help="db user password")
@click.option('--dsn', type=str)
@click.option('--db-user', type=str)
@click.option(f'--{SecretParams.DB_PASSWORD.value}', type=str,
prompt='DB password', prompt_required=False,
hide_input=True, default=SECRET_DISPLAY, callback=secret_callback)
@click.option('--saas-url', type=str,
default='https://cloud.exasol.com')
@click.option(f'--{SecretParams.SAAS_ACCOUNT_ID.value}', type=str,
prompt='SaaS account id', prompt_required=False,
hide_input=True, default=SECRET_DISPLAY, callback=secret_callback)
@click.option(f'--{SecretParams.SAAS_DATABASE_ID.value}', type=str,
prompt='SaaS database id', prompt_required=False,
hide_input=True, default=SECRET_DISPLAY, callback=secret_callback)
@click.option('--saas-database-name', type=str)
@click.option(f'--{SecretParams.SAAS_TOKEN.value}', type=str,
prompt='SaaS token', prompt_required=False,
hide_input=True, default=SECRET_DISPLAY, callback=secret_callback)
@click.option('--ssl-cert-path', type=str, default="")
@click.option('--ssl-client-cert-path', type=str, default="")
@click.option('--ssl-client-private-key', type=str, default="")
@click.option('--use-ssl-cert-validation/--no-use-ssl-cert-validation', type=bool, default=True)
@click.option('--schema', type=str, required=True, help="schema name")
@click.option('--print', 'verbose', type=bool, required=False,
@click.option('--print', 'verbose', type=bool, default=False,
is_flag=True, help="print out statements")
@click.option('--develop', type=bool, required=False,
@click.option('--develop', type=bool, default=False,
is_flag=True, help="generate and execute the scripts")
def main(host: str, port: str, user: str, pwd: str, schema: str,
verbose: bool = False, develop: bool = False):
def main(
dsn: str | None,
db_user: str | None,
db_pass: str | None,
saas_url: str | None,
saas_account_id: str | None,
saas_database_id: str | None,
saas_database_name: str | None,
saas_token: str | None,
ssl_cert_path: str,
ssl_client_cert_path: str,
ssl_client_private_key: str,
use_ssl_cert_validation: bool,
schema: str,
verbose: bool,
develop: bool):

logging.basicConfig(format='%(asctime)s - %(module)s - %(message)s',
level=logging.DEBUG)

DeployCreateStatements.create_and_run(
db_host=host,
db_port=port,
db_user=user,
db_pass=pwd,
schema=schema,
dsn=dsn,
db_user=db_user,
db_pass=db_pass,
saas_url=saas_url,
saas_account_id=saas_account_id,
saas_database_id=saas_database_id,
saas_database_name=saas_database_name,
saas_token=saas_token,
use_ssl_cert_validation=use_ssl_cert_validation,
ssl_trusted_ca=ssl_cert_path,
ssl_client_certificate=ssl_client_cert_path,
ssl_private_key=ssl_client_private_key,
to_print=verbose,
develop=develop
)
develop=develop)


if __name__ == "__main__":
Expand Down
42 changes: 8 additions & 34 deletions exasol_sagemaker_extension/deployment/deploy_create_statements.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from __future__ import annotations
import logging
import ssl

import pyexasol
from exasol.python_extension_common.connections.pyexasol_connection import open_pyexasol_connection

from exasol_sagemaker_extension.deployment import constants
from exasol_sagemaker_extension.deployment. \
generate_create_statement_autopilot_endpoint_deletion \
Expand Down Expand Up @@ -120,39 +122,11 @@ def create_statements():

@classmethod
def create_and_run(cls,
db_host: str,
db_port: str,
db_user: str,
db_pass: str,
schema: str,
to_print: bool,
develop: bool):
"""
Creates a database connection object based on the provided credentials
Creates an instance of the DeployCreateStatements passing the connection
object to it and calls its run method.

Parameters:
db_host - database host address
db_port - database port
db_user - database username
db_pass - the user password
schema - schema where the scripts should be created
to_print - if True the script creation SQL commands will be
printed rather than executed
develop - if True the scripts will be generated from scratch
"""

exasol_conn = pyexasol.connect(
dsn=f"{db_host}:{db_port}",
user=db_user,
password=db_pass,
compression=True,
encryption=True,
websocket_sslopt={
"cert_reqs": ssl.CERT_NONE,
}
)
schema: str,
to_print: bool = False,
develop: bool = False,
**kwargs):

exasol_conn = open_pyexasol_connection(**kwargs)
deployer = cls(exasol_conn, schema, to_print, develop)
deployer.run()
30 changes: 15 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sagemaker = "^2.59.1"
pyexasol = "^0.25.0"
importlib-resources = "^5.2.0"
click = "^8.0.3"
exasol-python-extension-common = ">=0.2.0"
exasol-python-extension-common = ">=0.3.0"
exasol-script-languages-container-tool = "^0.19.0"

[tool.poetry.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function install_localstack {
function checkout_exasol_test_container {
cnt_func=$((cnt_func+1))
echo -e "${YEL} Step-$cnt_func: ${GRA} Checkout Exasol test container ${NC}"
git clone --branch 1.6.0 https://github.com/exasol/integration-test-docker-environment.git
git clone --branch 3.0.0 https://github.com/exasol/integration-test-docker-environment.git
}

function spawn_exasol_environment {
Expand Down
91 changes: 0 additions & 91 deletions tests/ci_tests/fixtures/build_language_container_fixture.py

This file was deleted.

Loading
Loading