Skip to content

Commit

Permalink
Refactor paginator (#425)
Browse files Browse the repository at this point in the history
* capsule some of the request calls

* final touches

* make mypy happy

* add missing file

* implement the new paginator design

* adjust tests to the new design

* trunk catches

* remove wrong file

* small improvements

* make mypy happy

* adjust expected result for doctest

* further smaller fixes

* fix vocab test

* automate cancelling outdated workflow runs

* fix doctest

* fix test expectations

* remove tests that don't really make sense. I don't think we should process user supplied URLs too much.

* fix trunk check

* make API and data schema smarter. Delay init of DBschema to raise API connection error at right place.

* full circle and we still don't have the correct search results

* reenable tests

* stupid mistakes

* remove unmerged paths

* add missing page increase

* add good changes

* less error prone

* raw is better for debugging

* fix import error

* remove obsolete test
  • Loading branch information
InnocentBug authored Feb 26, 2024
1 parent cc50734 commit 7f3f664
Show file tree
Hide file tree
Showing 18 changed files with 392 additions and 510 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/docs_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ on:
- main
- develop
- "*"
concurrency:
# github.workflow: name of the workflow
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

# Cancel in-progress runs when a new workflow with the same group name is triggered
cancel-in-progress: true

jobs:
build:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/doctest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ on:
- main
- develop

concurrency:
# github.workflow: name of the workflow
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

# Cancel in-progress runs when a new workflow with the same group name is triggered
cancel-in-progress: true

jobs:
doctest:
strategy:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ on:
- main
- develop

concurrency:
# github.workflow: name of the workflow
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

# Cancel in-progress runs when a new workflow with the same group name is triggered
cancel-in-progress: true

jobs:
mypy-test:
strategy:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ on:
- main
- develop

concurrency:
# github.workflow: name of the workflow
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

# Cancel in-progress runs when a new workflow with the same group name is triggered
cancel-in-progress: true

jobs:
test-coverage:
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ on:
- main
- develop

concurrency:
# github.workflow: name of the workflow
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

# Cancel in-progress runs when a new workflow with the same group name is triggered
cancel-in-progress: true

jobs:
test-examples:
runs-on: ${{ matrix.os }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ on:
- develop
- "*"

concurrency:
# github.workflow: name of the workflow
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

# Cancel in-progress runs when a new workflow with the same group name is triggered
cancel-in-progress: true

jobs:
install:
runs-on: ${{ matrix.os }}
Expand Down
4 changes: 3 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
The fixtures are all functional fixtures that stay consistent between all tests.
"""
import logging
import os

import pytest
Expand Down Expand Up @@ -49,14 +50,15 @@ def cript_api():
"""
storage_token = os.getenv("CRIPT_STORAGE_TOKEN")

with cript.API(host=None, api_token=None, storage_token=storage_token) as api:
with cript.API(host=None, api_token=None, storage_token=storage_token, default_log_level=logging.DEBUG) as api:
# overriding AWS S3 cognito variables to be sure we do not upload test data to production storage
# staging AWS S3 cognito storage variables
api._IDENTITY_POOL_ID = "us-east-1:25043452-a922-43af-b8a6-7e938a9e55c1"
api._COGNITO_LOGIN_PROVIDER = "cognito-idp.us-east-1.amazonaws.com/us-east-1_vyK1N9p22"
api._BUCKET_NAME = "cript-stage-user-data"
# using the tests folder name within our cloud storage
api._BUCKET_DIRECTORY_NAME = "tests"
api.extra_api_log_debug_info = True

yield api

Expand Down
Loading

0 comments on commit 7f3f664

Please sign in to comment.