Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 3 additions & 51 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.8
python-version: 3.12
- name: Install nox
run: python -m pip install nox
- name: Run Unit Tests
Expand Down Expand Up @@ -69,30 +69,6 @@ jobs:
run: nox -s _all_samples
working-directory: samples

compliance_tests_13:
runs-on: ubuntu-latest

services:
emulator-0:
image: gcr.io/cloud-spanner-emulator/emulator
ports:
- 9010:9010

steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.8
- name: Install nox
run: python -m pip install nox
- name: Run Compliance Tests
run: nox -s compliance_test_13
env:
SPANNER_EMULATOR_HOST: localhost:9010
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging

compliance_tests_14:
runs-on: ubuntu-latest

Expand All @@ -108,7 +84,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.8
python-version: 3.12
- name: Install nox
run: python -m pip install nox
- name: Run Compliance Tests
Expand Down Expand Up @@ -181,35 +157,11 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.8
python-version: 3.12
- name: Install nox
run: python -m pip install nox
- name: Run Migration Tests
run: nox -s migration_test
env:
SPANNER_EMULATOR_HOST: localhost:9010
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging

migration1310_tests:
runs-on: ubuntu-latest

services:
emulator-0:
image: gcr.io/cloud-spanner-emulator/emulator:latest
ports:
- 9010:9010

steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.8
- name: Install nox
run: python -m pip install nox
- name: Run Migration Tests
run: nox -s migration_test_1310
env:
SPANNER_EMULATOR_HOST: localhost:9010
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
2 changes: 1 addition & 1 deletion migration_test_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main(argv):
instance = client.instance(instance_id="".join(instance_id).replace("/", ""))
database = instance.database("".join(database_id).replace("/", ""))

database.update_ddl(["DROP TABLE account", "DROP TABLE alembic_version"]).result(120)
database.update_ddl(["DROP TABLE IF EXISTS account", "DROP TABLE IF EXISTS alembic_version"]).result(120)


if __name__ == "__main__":
Expand Down
62 changes: 3 additions & 59 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class = StreamHandler

BLACK_VERSION = "black==22.3.0"
BLACK_PATHS = ["google", "test", "noxfile.py", "setup.py", "samples"]
DEFAULT_PYTHON_VERSION = "3.8"
DEFAULT_PYTHON_VERSION = "3.12"
DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 = "3.12"


Expand Down Expand Up @@ -126,50 +126,6 @@ def lint_setup_py(session):
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")


@nox.session(python=DEFAULT_PYTHON_VERSION)
def compliance_test_13(session):
"""Run SQLAlchemy dialect compliance test suite."""

# Check the value of `RUN_COMPLIANCE_TESTS` env var. It defaults to true.
if os.environ.get("RUN_COMPLIANCE_TESTS", "true") == "false":
session.skip("RUN_COMPLIANCE_TESTS is set to false, skipping")
# Sanity check: Only run tests if the environment variable is set.
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", "") and not os.environ.get(
"SPANNER_EMULATOR_HOST", ""
):
session.skip(
"Credentials or emulator host must be set via environment variable"
)

session.install(
"pytest-cov",
)

session.install("mock")
session.install(".[tracing]")
session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.24", "--force-reinstall")
session.run("pip", "install", "opentelemetry-api<=1.10", "--force-reinstall")
session.run("pip", "install", "opentelemetry-sdk<=1.10", "--force-reinstall")
session.run("python", "create_test_database.py")
session.run("pip", "install", "pytest==6.2.2", "--force-reinstall")
session.run(
"pip", "install", "pytest-asyncio<0.21.0", "--force-reinstall", "--no-deps"
)

session.run(
"py.test",
"--cov=google.cloud.sqlalchemy_spanner",
"--cov=test",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
"--asyncio-mode=auto",
"test/test_suite_13.py",
*session.posargs,
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def compliance_test_14(session):
"""Run SQLAlchemy dialect compliance test suite."""
Expand Down Expand Up @@ -333,15 +289,8 @@ def mockserver(session):

@nox.session(python=DEFAULT_PYTHON_VERSION)
def migration_test(session):
"""Test migrations with SQLAlchemy v1.3.11+ and Alembic"""
session.run("pip", "install", "sqlalchemy>=1.3.11,<2.0", "--force-reinstall")
_migration_test(session)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def migration_test_1310(session):
"""Test migrations with SQLAlchemy 1.3.10 or lower and Alembic"""
session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.10", "--force-reinstall")
"""Test migrations with SQLAlchemy v1.4 and Alembic"""
session.run("pip", "install", "sqlalchemy>=1.4,<2.0", "--force-reinstall")
_migration_test(session)


Expand All @@ -352,11 +301,6 @@ def _migration_test(session):
import os
import shutil

try:
import sqlalchemy
except:
session.run("pip", "install", "sqlalchemy>=1.3.11,<2.0", "--force-reinstall")

session.install("pytest")
session.install(".")
session.install("alembic")
Expand Down