Skip to content

Delayed diagnostics startup and maintenance upgrades #1741

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

Merged
merged 35 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
18d6f16
Using future_with_result from pytest_simcore.helpers.utils_mock
pcrespov Aug 21, 2020
4938616
Renamed ConnectionError to avoid colision with builtin exception
pcrespov Aug 21, 2020
be3ca49
Reorganized and classified fixtures with db
pcrespov Aug 21, 2020
f071d64
Moved mock fixtures to conftest
pcrespov Aug 21, 2020
1db7761
minor cleanup
pcrespov Aug 21, 2020
c5d40fd
WIP:started to setup new tests
pcrespov Aug 21, 2020
1992de3
Enhances logged_gather
pcrespov Aug 24, 2020
3a158ca
Fixes linter issues: exception chains and py3 super()
pcrespov Aug 24, 2020
ff287da
Fixes lynter error
pcrespov Aug 24, 2020
552c885
Updates linter disables
pcrespov Aug 24, 2020
d4d8c89
Auto-formatting servicelib
pcrespov Aug 24, 2020
be223c8
Upgrade api/tests reqs
pcrespov Aug 26, 2020
66fe61d
Upgrade postgres-database reqs
pcrespov Aug 26, 2020
bb51171
Upgrades s3wrapper reqs
pcrespov Aug 26, 2020
afbf759
Upgrades system tests reqs
pcrespov Aug 26, 2020
e9f7b16
Upgrades servicelib reqs
pcrespov Aug 26, 2020
979ceb8
updates simcore-sdk reqs
pcrespov Aug 26, 2020
c549f20
Minor
pcrespov Aug 26, 2020
2e2f4ca
Includes postgres-database unit-testing in CI
pcrespov Aug 26, 2020
863e740
Fixes coverage in pgdb
pcrespov Aug 26, 2020
a7538a2
Fixes explicit chain exceptions and autoformat
pcrespov Aug 21, 2020
520bedf
Explicit chain exceptions in api-server
pcrespov Aug 21, 2020
ae60d21
fixes raise-missing-from
pcrespov Aug 26, 2020
79ee2bb
Using suppress context manager
pcrespov Aug 21, 2020
8d17ff5
info
pcrespov Aug 26, 2020
729390b
fixes bandit sec failure
pcrespov Aug 26, 2020
f43e1b6
fixes on super-with-arguments and raise-missing-from
pcrespov Aug 26, 2020
1b462d1
more on new super
pcrespov Aug 26, 2020
c31d6d1
Fixes closing pools in pg tseting
pcrespov Aug 26, 2020
5fac816
Minor
pcrespov Aug 26, 2020
1ba46ae
Diagnostics in webserver starts after 60secs
pcrespov Aug 26, 2020
bcb157b
Fixes cosntant
pcrespov Aug 26, 2020
c236ee7
adds tests on constants
pcrespov Aug 26, 2020
474e0d8
adds delay as a setup variable instead of a const
pcrespov Aug 26, 2020
53713ba
Some info
pcrespov Aug 26, 2020
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
48 changes: 48 additions & 0 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ jobs:
with:
name: unit_sidecar_coverage
path: codeclimate.unit_sidecar_coverage.json

unit-test-frontend:
name: Unit-testing frontend
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -320,6 +321,53 @@ jobs:
- name: test
run: ./ci/github/unit-testing/python-linting.bash test

unit-test-postgres-database:
name: Unit-testing postgres-database
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: [3.6]
os: [ubuntu-20.04]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: setup docker
run: |
sudo ./ci/github/helpers/setup_docker_compose.bash
./ci/github/helpers/setup_docker_experimental.bash
./ci/github/helpers/setup_docker_buildx.bash
echo ::set-env name=DOCKER_BUILDX::1
- name: setup python environment
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
- name: show system version
run: ./ci/helpers/show_system_versions.bash
- uses: actions/cache@v1
name: getting cached data
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: install
run: ./ci/github/unit-testing/postgres-database.bash install
- name: test
run: ./ci/github/unit-testing/postgres-database.bash test
- uses: codecov/codecov-action@v1
with:
flags: unittests #optional
- name: prepare codeclimate coverage file
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter format-coverage -t coverage.py -o codeclimate.unit_postgresdb_coverage.json coverage.xml
- name: upload codeclimate coverage
uses: actions/upload-artifact@v2
with:
name: unit_postgresdb_coverage
path: codeclimate.unit_postgresdb_coverage.json

unit-test-service-library:
name: Unit-testing service-library
runs-on: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions api/tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
aiohttp==3.6.2 # via -r requirements.in, pytest-aiohttp
async-timeout==3.0.1 # via aiohttp
attrs==19.3.0 # via aiohttp, jsonschema, openapi-core, pytest
attrs==20.1.0 # via aiohttp, jsonschema, openapi-core, pytest
chardet==3.0.4 # via aiohttp
coverage==5.2.1 # via -r requirements.in, pytest-cov
idna-ssl==1.1.0 # via aiohttp
Expand Down Expand Up @@ -37,7 +37,7 @@ six==1.15.0 # via isodate, jsonschema, openapi-core, openapi-schem
strict-rfc3339==0.7 # via openapi-schema-validator
termcolor==1.1.0 # via pytest-sugar
toml==0.10.1 # via pytest
typing-extensions==3.7.4.2 # via aiohttp, yarl
typing-extensions==3.7.4.3 # via aiohttp, yarl
werkzeug==1.0.1 # via openapi-core
yarl==1.5.1 # via aiohttp
zipp==3.1.0 # via importlib-metadata
Expand Down
34 changes: 34 additions & 0 deletions ci/github/unit-testing/postgres-database.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
pushd packages/postgres-database; pip3 install -r requirements/ci.txt; popd;
pip list -v
}

test() {
pytest \
--color=yes \
--durations=10 \
--cov=simcore_postgres_database \
--cov-append \
--cov-report=term-missing \
--cov-report=xml \
--cov-config=.coveragerc \
--verbose \
packages/postgres-database/tests
}

# Check if the function exists (bash specific)
if declare -f "$1" > /dev/null
then
# call arguments verbatim
"$@"
else
# Show a helpful error
echo "'$1' is not a known function name" >&2
exit 1
fi
4 changes: 2 additions & 2 deletions packages/postgres-database/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
idna==2.10 # via yarl
multidict==4.7.6 # via yarl
psycopg2-binary==2.8.5 # via sqlalchemy
sqlalchemy[postgresql_psycopg2binary]==1.3.18 # via -r requirements/_base.in
typing-extensions==3.7.4.2 # via yarl
sqlalchemy[postgresql_psycopg2binary]==1.3.19 # via -r requirements/_base.in
typing-extensions==3.7.4.3 # via yarl
yarl==1.5.1 # via -r requirements/_base.in
4 changes: 2 additions & 2 deletions packages/postgres-database/requirements/_migration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ python-dateutil==2.8.1 # via alembic
python-editor==1.0.4 # via alembic
requests==2.24.0 # via docker
six==1.15.0 # via docker, python-dateutil, tenacity, websocket-client
sqlalchemy[postgresql_psycopg2binary]==1.3.18 # via -r requirements/_base.txt, alembic
sqlalchemy[postgresql_psycopg2binary]==1.3.19 # via -r requirements/_base.txt, alembic
tenacity==6.2.0 # via -r requirements/_migration.in
typing-extensions==3.7.4.2 # via -r requirements/_base.txt
typing-extensions==3.7.4.3 # via -r requirements/_base.txt, yarl
urllib3==1.25.10 # via -r requirements/_migration.in, requests
websocket-client==0.57.0 # via docker
yarl==1.5.1 # via -r requirements/_base.txt
14 changes: 9 additions & 5 deletions packages/postgres-database/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ docker[ssh]==4.3.1 # via -r requirements/_migration.txt, docker-compose
dockerpty==0.4.1 # via docker-compose
docopt==0.6.2 # via coveralls, docker-compose
faker==4.1.2 # via -r requirements/_test.in
idna==2.10 # via -r requirements/_migration.txt, requests, yarl
isort==4.3.21 # via pylint
idna-ssl==1.1.0 # via aiohttp
idna==2.10 # via -r requirements/_migration.txt, idna-ssl, requests, yarl
importlib-metadata==1.7.0 # via jsonschema, pluggy, pytest
isort==5.4.2 # via pylint
jsonschema==3.2.0 # via docker-compose
lazy-object-proxy==1.4.3 # via astroid
mako==1.1.3 # via -r requirements/_migration.txt, alembic
Expand All @@ -40,7 +42,7 @@ pluggy==0.13.1 # via pytest
psycopg2-binary==2.8.5 # via -r requirements/_migration.txt, aiopg, sqlalchemy
py==1.9.0 # via pytest
pycparser==2.20 # via cffi
pylint==2.5.3 # via -r requirements/_test.in
pylint==2.6.0 # via -r requirements/_test.in
pynacl==1.4.0 # via paramiko
pyparsing==2.4.7 # via packaging
pyrsistent==0.16.0 # via jsonschema
Expand All @@ -56,17 +58,19 @@ python-editor==1.0.4 # via -r requirements/_migration.txt, alembic
pyyaml==5.3.1 # via -r requirements/_test.in, docker-compose
requests==2.24.0 # via -r requirements/_migration.txt, coveralls, docker, docker-compose
six==1.15.0 # via -r requirements/_migration.txt, astroid, bcrypt, cryptography, docker, docker-compose, dockerpty, jsonschema, packaging, pynacl, pyrsistent, python-dateutil, tenacity, websocket-client
sqlalchemy[postgresql_psycopg2binary]==1.3.18 # via -r requirements/_migration.txt, aiopg, alembic
sqlalchemy[postgresql_psycopg2binary]==1.3.19 # via -r requirements/_migration.txt, aiopg, alembic
tenacity==6.2.0 # via -r requirements/_migration.txt
text-unidecode==1.3 # via faker
texttable==1.6.2 # via docker-compose
toml==0.10.1 # via pylint
typing-extensions==3.7.4.2 # via -r requirements/_migration.txt
typed-ast==1.4.1 # via astroid
typing-extensions==3.7.4.3 # via -r requirements/_migration.txt, aiohttp, yarl
urllib3==1.25.10 # via -r requirements/_migration.txt, requests
wcwidth==0.2.5 # via pytest
websocket-client==0.57.0 # via -r requirements/_migration.txt, docker, docker-compose
wrapt==1.12.1 # via astroid
yarl==1.5.1 # via -r requirements/_migration.txt, aiohttp
zipp==3.1.0 # via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
5 changes: 4 additions & 1 deletion packages/postgres-database/requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
# installs base + tests requirements
-r _test.txt

# installs this repo's packages
-e ../../packages/pytest-simcore/

# current module
.
.[migration]
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,27 @@


@pytest.fixture
def engine(make_engine, loop):
async def start():
engine = await make_engine()
sync_engine = make_engine(False)
metadata.drop_all(sync_engine)
metadata.create_all(sync_engine)

async with engine.acquire() as conn:
await conn.execute(users.insert().values(**random_user(name="A")))
await conn.execute(users.insert().values(**random_user()))
await conn.execute(users.insert().values(**random_user()))

await conn.execute(projects.insert().values(**random_project(prj_owner=1)))
await conn.execute(projects.insert().values(**random_project(prj_owner=2)))
await conn.execute(projects.insert().values(**random_project(prj_owner=3)))
with pytest.raises(ForeignKeyViolation):
await conn.execute(
projects.insert().values(**random_project(prj_owner=4))
)

return engine

return loop.run_until_complete(start())
async def engine(make_engine, loop):
engine = await make_engine()
sync_engine = make_engine(False)
metadata.drop_all(sync_engine)
metadata.create_all(sync_engine)

async with engine.acquire() as conn:
await conn.execute(users.insert().values(**random_user(name="A")))
await conn.execute(users.insert().values(**random_user()))
await conn.execute(users.insert().values(**random_user()))

await conn.execute(projects.insert().values(**random_project(prj_owner=1)))
await conn.execute(projects.insert().values(**random_project(prj_owner=2)))
await conn.execute(projects.insert().values(**random_project(prj_owner=3)))
with pytest.raises(ForeignKeyViolation):
await conn.execute(projects.insert().values(**random_project(prj_owner=4)))

yield engine

engine.close()
await engine.wait_closed()


@pytest.mark.skip(reason="sandbox for dev purposes")
Expand Down
34 changes: 18 additions & 16 deletions packages/postgres-database/tests/test_uniqueness_in_comp_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@


@pytest.fixture
def engine(make_engine, loop):
async def start():
engine = await make_engine()
sync_engine = make_engine(False)
metadata.drop_all(sync_engine)
metadata.create_all(sync_engine)

async with engine.acquire() as conn:
await conn.execute(
comp_pipeline.insert().values(**fake_pipeline(project_id="PA"))
)
await conn.execute(
comp_pipeline.insert().values(**fake_pipeline(project_id="PB"))
)
async def engine(loop, make_engine):

engine = await make_engine()
sync_engine = make_engine(False)
metadata.drop_all(sync_engine)
metadata.create_all(sync_engine)

async with engine.acquire() as conn:
await conn.execute(
comp_pipeline.insert().values(**fake_pipeline(project_id="PA"))
)
await conn.execute(
comp_pipeline.insert().values(**fake_pipeline(project_id="PB"))
)

yield engine

return engine
engine.close()
await engine.wait_closed()

return loop.run_until_complete(start())


async def test_unique_project_node_pairs(engine):
Expand Down
6 changes: 3 additions & 3 deletions packages/s3wrapper/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ coveralls==2.1.2 # via -r requirements/_test.in
cryptography==3.0 # via paramiko
distro==1.5.0 # via docker-compose
docker-compose==1.26.2 # via pytest-docker
docker[ssh]==4.3.0 # via docker-compose
docker[ssh]==4.3.1 # via docker-compose
dockerpty==0.4.1 # via docker-compose
docopt==0.6.2 # via coveralls, docker-compose
idna==2.10 # via requests
importlib-metadata==1.7.0 # via jsonschema, pluggy, pytest
isort==4.3.21 # via pylint
isort==5.4.2 # via pylint
jsonschema==3.2.0 # via docker-compose
lazy-object-proxy==1.4.3 # via astroid
mccabe==0.6.1 # via pylint
Expand All @@ -33,7 +33,7 @@ paramiko==2.7.1 # via docker
pluggy==0.13.1 # via pytest
py==1.9.0 # via pytest
pycparser==2.20 # via cffi
pylint==2.5.3 # via -r requirements/_test.in
pylint==2.6.0 # via -r requirements/_test.in
pynacl==1.4.0 # via paramiko
pyparsing==2.4.7 # via packaging
pyrsistent==0.16.0 # via jsonschema
Expand Down
2 changes: 1 addition & 1 deletion packages/service-library/requirements/_base.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ werkzeug
jsonschema
prometheus_client
tenacity
attrs
attrs<20,>=19 # from pytest-docker==0.8.0
trafaret
aiodebug
4 changes: 2 additions & 2 deletions packages/service-library/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ psycopg2-binary==2.8.5 # via -r requirements/_base.in, aiopg, sqlalchemy
pyrsistent==0.16.0 # via jsonschema
pyyaml==5.3.1 # via -r requirements/_base.in, openapi-spec-validator
six==1.15.0 # via isodate, jsonschema, openapi-core, openapi-spec-validator, pyrsistent, tenacity
sqlalchemy[postgresql_psycopg2binary]==1.3.18 # via -r requirements/_base.in, aiopg
sqlalchemy[postgresql_psycopg2binary]==1.3.19 # via -r requirements/_base.in, aiopg
strict-rfc3339==0.7 # via openapi-core
tenacity==6.2.0 # via -r requirements/_base.in
trafaret==2.0.2 # via -r requirements/_base.in
typing-extensions==3.7.4.2 # via aiohttp, yarl
typing-extensions==3.7.4.3 # via aiohttp, yarl
ujson==3.1.0 # via -r requirements/_base.in
werkzeug==1.0.1 # via -r requirements/_base.in
yarl==1.5.1 # via aiohttp
Expand Down
12 changes: 6 additions & 6 deletions packages/service-library/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ coveralls==2.1.2 # via -r requirements/_test.in
cryptography==3.0 # via paramiko
distro==1.5.0 # via docker-compose
docker-compose==1.26.2 # via pytest-docker
docker[ssh]==4.3.0 # via docker-compose
docker[ssh]==4.3.1 # via docker-compose
dockerpty==0.4.1 # via docker-compose
docopt==0.6.2 # via coveralls, docker-compose
idna-ssl==1.1.0 # via -r requirements/_base.txt, aiohttp
idna==2.10 # via -r requirements/_base.txt, idna-ssl, requests, yarl
importlib-metadata==1.7.0 # via -r requirements/_base.txt, jsonschema, pluggy, pytest
isodate==0.6.0 # via -r requirements/_base.txt, openapi-core
isort==4.3.21 # via pylint
isort==5.4.2 # via pylint
jsonschema==3.2.0 # via -r requirements/_base.txt, docker-compose, openapi-spec-validator
lazy-object-proxy==1.4.3 # via -r requirements/_base.txt, astroid, openapi-core
mccabe==0.6.1 # via pylint
Expand All @@ -43,31 +43,31 @@ prometheus-client==0.8.0 # via -r requirements/_base.txt
psycopg2-binary==2.8.5 # via -r requirements/_base.txt, aiopg, sqlalchemy
py==1.9.0 # via pytest
pycparser==2.20 # via cffi
pylint==2.5.3 # via -r requirements/_test.in
pylint==2.6.0 # via -r requirements/_test.in
pynacl==1.4.0 # via paramiko
pyparsing==2.4.7 # via packaging
pyrsistent==0.16.0 # via -r requirements/_base.txt, jsonschema
pytest-aiohttp==0.3.0 # via -r requirements/_test.in
pytest-cov==2.10.1 # via -r requirements/_test.in
pytest-docker==0.8.0 # via -r requirements/_test.in
pytest-instafail==0.4.2 # via -r requirements/_test.in
pytest-mock==3.2.0 # via -r requirements/_test.in
pytest-mock==3.3.0 # via -r requirements/_test.in
pytest-runner==5.2 # via -r requirements/_test.in
pytest-sugar==0.9.4 # via -r requirements/_test.in
pytest==5.4.3 # via -r requirements/_test.in, pytest-aiohttp, pytest-cov, pytest-docker, pytest-instafail, pytest-mock, pytest-sugar
python-dotenv==0.14.0 # via docker-compose
pyyaml==5.3.1 # via -r requirements/_base.txt, docker-compose, openapi-spec-validator
requests==2.24.0 # via coveralls, docker, docker-compose
six==1.15.0 # via -r requirements/_base.txt, astroid, bcrypt, cryptography, docker, docker-compose, dockerpty, isodate, jsonschema, openapi-core, openapi-spec-validator, packaging, pynacl, pyrsistent, tenacity, websocket-client
sqlalchemy[postgresql_psycopg2binary]==1.3.18 # via -r requirements/_base.txt, aiopg
sqlalchemy[postgresql_psycopg2binary]==1.3.19 # via -r requirements/_base.txt, aiopg
strict-rfc3339==0.7 # via -r requirements/_base.txt, openapi-core
tenacity==6.2.0 # via -r requirements/_base.txt
termcolor==1.1.0 # via pytest-sugar
texttable==1.6.2 # via docker-compose
toml==0.10.1 # via pylint
trafaret==2.0.2 # via -r requirements/_base.txt
typed-ast==1.4.1 # via astroid
typing-extensions==3.7.4.2 # via -r requirements/_base.txt, aiohttp, yarl
typing-extensions==3.7.4.3 # via -r requirements/_base.txt, aiohttp, yarl
ujson==3.1.0 # via -r requirements/_base.txt
urllib3==1.25.10 # via requests
wcwidth==0.2.5 # via pytest
Expand Down
Loading