Skip to content

Commit

Permalink
CI/CD problem analysis (#1919)
Browse files Browse the repository at this point in the history
  • Loading branch information
milanaleksic authored Aug 1, 2023
1 parent 78de6af commit 9081187
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pr.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
- name: Test with tox
run: |
tox -- soda -k soda/core
tox -- soda -k soda/${{ matrix.data-source }}
tox --exit-and-dump-after 3600 -- soda -k soda/core
tox --exit-and-dump-after 3600 -- soda -k soda/${{ matrix.data-source }}
env:
test_data_source: ${{ matrix.data-source }}

Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Test with tox
run: |
tox -- soda -k soda/core
tox --exit-and-dump-after 3600 -- soda -k soda/core
env:
test_data_source: postgres
WESTMALLE: BETTER_THAN_LA_TRAPPE
Expand Down Expand Up @@ -148,4 +148,4 @@ jobs:
- name: Test with tox
run: |
tox -- soda -k soda/scientific
tox --exit-and-dump-after 3600 -- soda -k soda/scientific
2 changes: 1 addition & 1 deletion dev-requirements.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pip-tools~=6.5
pytest~=7.0
python-dotenv~=1.0
tox~=3.24
tox~=4.6
tox-docker~=4.1
pytest-html~=3.1
pytest-cov~=3.0
Expand Down
20 changes: 14 additions & 6 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ bleach==6.0.0
# via readme-renderer
build==0.10.0
# via pip-tools
cachetools==5.3.1
# via tox
certifi==2023.5.7
# via
# -r dev-requirements.in
# requests
chardet==5.1.0
# via tox
charset-normalizer==3.2.0
# via requests
cli-ui==0.17.2
Expand All @@ -23,7 +27,9 @@ click==8.1.5
# black
# pip-tools
colorama==0.4.6
# via cli-ui
# via
# cli-ui
# tox
contextlib2==21.6.0
# via schema
coverage[toml]==7.2.7
Expand Down Expand Up @@ -53,6 +59,7 @@ mypy-extensions==1.0.0
packaging==23.1
# via
# build
# pyproject-api
# pytest
# tox
# tox-docker
Expand All @@ -63,19 +70,20 @@ pip-tools==6.14.0
platformdirs==3.8.1
# via
# black
# tox
# virtualenv
pluggy==1.2.0
# via
# pytest
# tox
py==1.11.0
# via
# pytest-html
# tox
# via pytest-html
pygments==2.15.1
# via
# -r dev-requirements.in
# readme-renderer
pyproject-api==1.5.3
# via tox
pyproject-hooks==1.0.0
# via build
pytest==7.4.0
Expand Down Expand Up @@ -104,7 +112,6 @@ six==1.16.0
# via
# bleach
# python-dateutil
# tox
tabulate==0.8.10
# via cli-ui
tbump==6.10.0
Expand All @@ -115,12 +122,13 @@ tomli==2.0.1
# build
# coverage
# pip-tools
# pyproject-api
# pyproject-hooks
# pytest
# tox
tomlkit==0.11.8
# via tbump
tox==3.28.0
tox==4.6.4
# via
# -r dev-requirements.in
# tox-docker
Expand Down
7 changes: 6 additions & 1 deletion soda/core/tests/helpers/data_source_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def create_test_scan(self) -> TestScan:

def _test_session_ends(self):
self.data_source.connection.close()
self._drop_schema_if_exists()
if not is_cicd():
self._drop_schema_if_exists()
self.schema_data_source.connection.close()

def _drop_schema_if_exists(self):
Expand Down Expand Up @@ -253,3 +254,7 @@ def _update(self, sql: str, connection=None) -> object:
return updates
finally:
cursor.close()


def is_cicd():
return os.getenv("GITHUB_ACTIONS") is not None
5 changes: 2 additions & 3 deletions soda/postgres/tests/postgres_data_source_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
import logging
import os

from helpers.data_source_fixture import DataSourceFixture
from helpers.data_source_fixture import DataSourceFixture, is_cicd

logger = logging.getLogger(__name__)


class PostgresDataSourceFixture(DataSourceFixture):
def __init__(self, test_data_source: str):
super().__init__(test_data_source=test_data_source)
is_local_dev = os.getenv("GITHUB_ACTIONS") is None
is_schema_reuse_disabled = os.getenv("POSTGRES_REUSE_SCHEMA", "").lower() == "disabled"
self.local_dev_schema_reused = is_local_dev and not is_schema_reuse_disabled
self.local_dev_schema_reused = (not is_cicd()) and not is_schema_reuse_disabled

def _build_configuration_dict(self, schema_name: str | None = None) -> dict:
return {
Expand Down

0 comments on commit 9081187

Please sign in to comment.