Skip to content

Commit

Permalink
#120 Running tests in SaaS only
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Jul 1, 2024
1 parent da2f8a1 commit 862f570
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tests/deployment/test_deploy_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_deploy_cli_main(backend, db_conn, deploy_params):
args_list.append("--no-use-ssl-cert-validation")

runner = CliRunner()
result = runner.invoke(deploy_cli.main, args_list)
result = runner.invoke(deploy_cli.main, args_list, catch_exceptions=False)
assert result.exit_code == 0

all_schemas = get_all_schemas(db_conn)
Expand Down
5 changes: 3 additions & 2 deletions tests/deployment/test_deploy_create_statements.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import exasol.bucketfs as bfs

from exasol_sagemaker_extension.deployment.deploy_create_statements import \
DeployCreateStatements
Expand Down Expand Up @@ -28,10 +29,10 @@ def get_all_scripts(db_conn):


@pytest.mark.slow
def test_deploy_create_statements(db_conn, deploy_params):
def test_deploy_create_statements(backend, db_conn, deploy_params):

# We validate the server certificate in SaaS, but not in the Docker DB
cert_validation = "saas_url" in deploy_params
cert_validation = backend == bfs.path.StorageBackend.saas
DeployCreateStatements.create_and_run(**deploy_params, schema=DB_SCHEMA,
use_ssl_cert_validation=cert_validation)

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/database_connection_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _open_pyexasol_connection(**kwargs) -> pyexasol.ExaConnection:
compression=True)


@pytest.fixture(scope='session', params=[bfs.path.StorageBackend.onprem, bfs.path.StorageBackend.saas])
@pytest.fixture(scope='session', params=[bfs.path.StorageBackend.saas])
def backend(request) -> bfs.path.StorageBackend:
# Here we are going to add
# pytest.skip()
Expand Down
16 changes: 5 additions & 11 deletions tests/fixtures/prepare_environment_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
import pyexasol
import exasol.bucketfs as bfs
import pytest
from click.testing import CliRunner

from exasol_sagemaker_extension.deployment import deploy_cli
from exasol_sagemaker_extension.deployment.deploy_create_statements import DeployCreateStatements
from tests.ci_tests.utils.parameters import (
get_arg_list, reg_model_setup_params, cls_model_setup_params)
reg_model_setup_params, cls_model_setup_params)


def _open_schema(db_conn: pyexasol.ExaConnection, model_setup):
Expand All @@ -23,14 +22,9 @@ def _open_schema(db_conn: pyexasol.ExaConnection, model_setup):

def _deploy_scripts(backend: bfs.path.StorageBackend, deploy_params: dict[str, Any], schema: str):

args_list = get_arg_list(**deploy_params, schema=schema)
if backend == bfs.path.StorageBackend.saas:
args_list.append("--use-ssl-cert-validation")
else:
args_list.append("--no-use-ssl-cert-validation")

runner = CliRunner()
runner.invoke(deploy_cli.main, args_list)
cert_validation = backend == bfs.path.StorageBackend.saas
DeployCreateStatements.create_and_run(**deploy_params, schema=schema,
use_ssl_cert_validation=cert_validation)


def _create_tables(db_conn, model_setup):
Expand Down

0 comments on commit 862f570

Please sign in to comment.