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

ASP-2438 Speed up tests on Jobbergate API #212

Merged
merged 4 commits into from Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 23 additions & 22 deletions .github/workflows/test_on_push.yaml
@@ -1,4 +1,4 @@
name: 'Test'
name: "Test"

on:
push:
Expand All @@ -9,7 +9,7 @@ on:
jobs:
api-tests:
name: "jobbergate-api tests"
runs-on: "ubuntu-latest"
runs-on: "ubuntu-20.04"
services:
test-db:
image: postgres
Expand All @@ -25,14 +25,15 @@ jobs:
ports:
- 5433:5432
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- uses: Gr1N/setup-poetry@v7
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==1.1.14
- uses: actions/setup-python@v4
with:
poetry-version: 1.1.14
python-version: "3.8"
architecture: "x64"
cache: "poetry"
cache-dependency-path: jobbergate-api/poetry.lock
- name: "run quality control checks"
working-directory: jobbergate-api
env:
Expand All @@ -41,25 +42,25 @@ jobs:
TEST_DATABASE_USER: test
TEST_DATABASE_PSWD: test-pswd
TEST_DATABASE_NAME: test-jobbergate
POETRY_HTTP_BASIC_PYPICLOUD_USERNAME: admin
POETRY_HTTP_BASIC_PYPICLOUD_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: make qa
run: |
poetry env use "3.8"
fschuch marked this conversation as resolved.
Show resolved Hide resolved
make qa

cli-tests:
name: "jobbergate-cli tests"
runs-on: "ubuntu-20.04"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==1.1.14
- uses: actions/setup-python@v4
with:
python-version: "3.6"
architecture: 'x64'
- uses: Gr1N/setup-poetry@v7
with:
poetry-version: 1.1.14
architecture: "x64"
cache: "poetry"
cache-dependency-path: jobbergate-cli/poetry.lock
- name: "run quality control checks"
working-directory: jobbergate-cli
env:
POETRY_HTTP_BASIC_PYPICLOUD_USERNAME: admin
POETRY_HTTP_BASIC_PYPICLOUD_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: make qa
run: |
poetry env use "3.6"
fschuch marked this conversation as resolved.
Show resolved Hide resolved
make qa
Expand Up @@ -14,6 +14,8 @@
from jobbergate_api.apps.permissions import Permissions
from jobbergate_api.storage import database, fetch_instance

pytestmark = pytest.mark.usefixtures("startup_event_force")
fschuch marked this conversation as resolved.
Show resolved Hide resolved


@pytest.mark.asyncio
async def test_create_application(
Expand Down
Expand Up @@ -18,6 +18,8 @@
from jobbergate_api.apps.permissions import Permissions
from jobbergate_api.storage import database

pytestmark = pytest.mark.usefixtures("startup_event_force")


@pytest.fixture
def job_script_data_as_string():
Expand Down
Expand Up @@ -16,6 +16,8 @@
from jobbergate_api.apps.permissions import Permissions
from jobbergate_api.storage import database

pytestmark = pytest.mark.usefixtures("startup_event_force")


@pytest.mark.asyncio
async def test_create_job_submission__with_client_id_in_token(
Expand Down
3 changes: 1 addition & 2 deletions jobbergate-api/jobbergate_api/tests/conftest.py
Expand Up @@ -56,8 +56,7 @@ async def enforce_empty_database(database_engine):
metadata.drop_all(database_engine)


@pytest.fixture(autouse=True)
@pytest.mark.enforce_empty_database()
@pytest.fixture()
async def startup_event_force():
"""
Force the async event loop to begin.
Expand Down
2 changes: 2 additions & 0 deletions jobbergate-api/jobbergate_api/tests/test_pagination.py
Expand Up @@ -12,6 +12,8 @@
from jobbergate_api.pagination import Pagination, Response, package_response
from jobbergate_api.storage import database

pytestmark = pytest.mark.usefixtures("startup_event_force")


def test_init_fails_on_invalid_parameters():
"""
Expand Down
2 changes: 2 additions & 0 deletions jobbergate-api/jobbergate_api/tests/test_storage.py
Expand Up @@ -10,6 +10,8 @@
from jobbergate_api.metadata import metadata
from jobbergate_api.storage import build_db_url, database, sort_clause

pytestmark = pytest.mark.usefixtures("startup_event_force")


def test_build_db_url__creates_database_url_from_parts(tweak_settings):
"""
Expand Down