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

🐛 Restrict client version for logstreaming e2e test and don't fail when cleaning up jobs in e2e tests #146

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
9c15998
update workflow before publishing python package
bisgaard-itis Oct 23, 2023
ab1bc1e
Merge branch 'master' of github.com:bisgaard-itis/osparc-simcore-clients
bisgaard-itis Oct 23, 2023
60c4f60
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 23, 2023
3aa7d70
fix dependency issue and bump version
bisgaard-itis Oct 23, 2023
a9810d4
Merge branch 'master' of github.com:bisgaard-itis/osparc-simcore-clients
bisgaard-itis Oct 23, 2023
5d2ceb2
point to website in project description
bisgaard-itis Oct 23, 2023
185195c
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 23, 2023
f58c10f
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 26, 2023
fdd75b7
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Oct 27, 2023
11e369d
fix broken dependency
bisgaard-itis Nov 2, 2023
e844983
improve doc
bisgaard-itis Nov 2, 2023
c798687
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 2, 2023
55bdba4
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
9ce0911
add github token to download artifacts
bisgaard-itis Nov 3, 2023
39210ef
ensure only read-access @wvangeit
bisgaard-itis Nov 3, 2023
50c487f
yet another attempt at downloading artifacts
bisgaard-itis Nov 3, 2023
128a1a7
resolve merge conflicts
bisgaard-itis Nov 3, 2023
3d8d1eb
make sure to use repo that ran the trigger wf
bisgaard-itis Nov 3, 2023
3f2b07a
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
48cf475
another attempt at fixing
bisgaard-itis Nov 3, 2023
77d1e81
change owner
bisgaard-itis Nov 3, 2023
21b446b
change repo owner
bisgaard-itis Nov 3, 2023
10b5ce0
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
d90cccc
allow publishing to testpypi also when pr
bisgaard-itis Nov 3, 2023
b1561a4
minor change
bisgaard-itis Nov 3, 2023
2db2d81
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
a22c0c4
revert minor (but breaking) change
bisgaard-itis Nov 3, 2023
9a6a1e0
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
a83b349
minor fix
bisgaard-itis Nov 3, 2023
e4e07d7
Merge branch 'master' of github.com:bisgaard-itis/osparc-simcore-clients
bisgaard-itis Nov 3, 2023
0bd41d9
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
565a00e
add debug messages
bisgaard-itis Nov 3, 2023
f8fd235
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
a3e668f
another debug message
bisgaard-itis Nov 3, 2023
7a77a55
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
1e03c59
hopefully the final version
bisgaard-itis Nov 3, 2023
fe3f2b0
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
a0c8668
final fix
bisgaard-itis Nov 3, 2023
aa312f6
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
86a6f79
minor fix
bisgaard-itis Nov 3, 2023
5a341c6
move master and tag to individual jobs
bisgaard-itis Nov 3, 2023
abfc0a4
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
c823bff
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
817d236
add debug messages
bisgaard-itis Nov 3, 2023
ee3c218
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 3, 2023
5988a7c
dev->post
bisgaard-itis Nov 3, 2023
b6ce6c5
add python script for determining semantic version
bisgaard-itis Nov 6, 2023
08dd828
minor changes
bisgaard-itis Nov 6, 2023
a411cca
minor changes
bisgaard-itis Nov 6, 2023
d482706
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
0f7db5a
improve error handling and add version file to artifacts
bisgaard-itis Nov 6, 2023
9e88276
check if release
bisgaard-itis Nov 6, 2023
9b84b5c
minor fix
bisgaard-itis Nov 6, 2023
0264d2d
ensure to enter venv
bisgaard-itis Nov 6, 2023
20d095f
also when tagging
bisgaard-itis Nov 6, 2023
f513b51
source venv in publishin workflow
bisgaard-itis Nov 6, 2023
f3ea1f6
ensure only master
bisgaard-itis Nov 6, 2023
0ee27ea
add script for testing 'pure' semver
bisgaard-itis Nov 6, 2023
b683f49
adapt workflows to new python script
bisgaard-itis Nov 6, 2023
2f4d002
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
113313c
minor change
bisgaard-itis Nov 6, 2023
57579c7
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
ba5312f
attempt to evaluate expressions correctly
bisgaard-itis Nov 6, 2023
43e143d
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
9f5e181
several fixes to fix tests
bisgaard-itis Nov 6, 2023
8411cb9
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
14c32d5
ensure repo is checked out in publish workflow
bisgaard-itis Nov 6, 2023
cf79e93
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
99e4ca0
several small fixes
bisgaard-itis Nov 6, 2023
bbbecc9
cleanup
bisgaard-itis Nov 6, 2023
5c85d32
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
adfb76a
debug
bisgaard-itis Nov 6, 2023
b153609
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
ff20bad
minor cleanup
bisgaard-itis Nov 6, 2023
c30f0e9
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
7c0e7aa
mionr changes
bisgaard-itis Nov 6, 2023
c48ba12
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
0e15e33
add debug message
bisgaard-itis Nov 6, 2023
787fbf5
minor change
bisgaard-itis Nov 6, 2023
d2fbe1f
resolve conflicts
bisgaard-itis Nov 6, 2023
2ddf381
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
19f2545
minor change
bisgaard-itis Nov 6, 2023
efee6c4
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
0d761d3
yet another try
bisgaard-itis Nov 6, 2023
5a90aae
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
c29c5e6
minor change
bisgaard-itis Nov 6, 2023
52924e1
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
482c367
minor change
bisgaard-itis Nov 6, 2023
8fda0d0
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
22d9173
minor change
bisgaard-itis Nov 6, 2023
3bfe395
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 6, 2023
ea346f9
mionr change
bisgaard-itis Nov 6, 2023
1c46a9e
minor changes
bisgaard-itis Nov 6, 2023
630ee16
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 7, 2023
be216bc
correct workflow run id
bisgaard-itis Nov 7, 2023
3df8511
cosmetic change
bisgaard-itis Nov 7, 2023
5318be6
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 7, 2023
33df63c
avoid using gh
bisgaard-itis Nov 7, 2023
9157b4a
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 7, 2023
ff97cc3
change to a single job for publishing
bisgaard-itis Nov 7, 2023
efb58f8
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 7, 2023
8f97bdd
minor cleanup
bisgaard-itis Nov 7, 2023
cfbe546
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 7, 2023
52e6bd1
Merge branch 'ITISFoundation:master' into master
bisgaard-itis Nov 9, 2023
b011d68
merge itis/master into master
bisgaard-itis Nov 22, 2023
ce76b43
merge itis/master into master
bisgaard-itis Dec 5, 2023
a915631
merge itis/master into master
bisgaard-itis Dec 8, 2023
a08216f
merge itis/master into master
bisgaard-itis Jan 8, 2024
958c8c6
swap loops in clean up jobs
bisgaard-itis Jan 9, 2024
a2b9c53
correction
bisgaard-itis Jan 9, 2024
0404b74
merge itis/master into master
bisgaard-itis Jan 10, 2024
b845806
merge itis/master into master
bisgaard-itis Jan 10, 2024
9dba891
merge itis/master into master
bisgaard-itis Jan 23, 2024
6fe4a20
merge itis/master into master
bisgaard-itis Feb 26, 2024
e1a2f2d
update server compatibility to new url
bisgaard-itis Feb 28, 2024
e066bd0
merge itis/master into master
bisgaard-itis Feb 29, 2024
1c56fcb
minor change to trigger ci
bisgaard-itis Feb 29, 2024
111656d
merge itis/master into master
bisgaard-itis Mar 4, 2024
ccfd63c
merge itis/master into master
bisgaard-itis Mar 20, 2024
f4e0302
merge itis/master into master
bisgaard-itis Mar 21, 2024
13cca02
merge itis/master into master
bisgaard-itis Mar 22, 2024
2976700
merge itis/master into master
bisgaard-itis Mar 22, 2024
584d2ea
introduce decorator to filter tests based on client version
bisgaard-itis Apr 4, 2024
c4d34db
test if it works
bisgaard-itis Apr 4, 2024
d55a363
remove file which was wrongly committed
bisgaard-itis Apr 4, 2024
111ff3e
improve doc string
bisgaard-itis Apr 4, 2024
1090812
small cleanup
bisgaard-itis Apr 4, 2024
06405aa
dont fail postprocessing step if deleting a job fails
bisgaard-itis Apr 4, 2024
f572093
@pcrespov change name
bisgaard-itis Apr 5, 2024
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
24 changes: 22 additions & 2 deletions clients/python/test/e2e/_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import subprocess
from pathlib import Path
from typing import Optional

import osparc
import pytest
Expand All @@ -23,15 +24,34 @@ def repo_version() -> Version:
return Version(version_file.read_text())


def requires_dev_features(test):
def skip_if_no_dev_features(test):
if (
Version(osparc.__version__) < repo_version()
or not osparc_dev_features_enabled()
):
return pytest.mark.skip(
(
f"{osparc.__version__=}<{str(repo_version)} "
"or {osparc_dev_features_enabled()=}"
f"or {osparc_dev_features_enabled()=}"
)
)(test)
return test


def skip_if_osparc_version(
*,
at_least: Optional[Version] = None,
at_most: Optional[Version] = None,
exactly: Optional[Version] = None,
):
bisgaard-itis marked this conversation as resolved.
Show resolved Hide resolved
def _wrapper(test):
osparc_version = Version(osparc.__version__)
if at_least and osparc_version < at_least:
return pytest.mark.skip((f"{osparc_version=}<{at_least}"))(test)
if at_most and osparc_version > at_most:
return pytest.mark.skip((f"{osparc_version=}>{at_most}"))(test)
if exactly and osparc_version != exactly:
return pytest.mark.skip((f"{osparc_version=}!={exactly}"))(test)
return test

return _wrapper
52 changes: 33 additions & 19 deletions clients/python/test/e2e/ci/e2e/e2e/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
import typer
from pydantic import PositiveInt
from tenacity import (
RetryError,
Retrying,
retry_if_exception_type,
stop_after_attempt,
stop_after_delay,
)
from urllib3.exceptions import HTTPError as Urllib3HttpError

from ._models import Artifacts, ClientSettings, PytestIniFile, ServerSettings
from ._utils import E2eExitCodes, E2eScriptFailure, handle_validation_error
Expand Down Expand Up @@ -219,22 +221,34 @@ def clean_up_jobs(artifacts_dir: Path, retry_minutes: Optional[PositiveInt] = No
msg = "Cleaning up jobs for user: "
msg += f"\n{server_config.model_dump_json(indent=1)}"
typer.echo(msg)
for attempt in Retrying(
retry=retry_if_exception_type(osparc.ApiException),
stop=stop_after_delay(timedelta(minutes=retry_minutes))
if retry_minutes
else stop_after_attempt(1),
):
with attempt:
with osparc.ApiClient(config) as api_client:
solvers_api = osparc.SolversApi(api_client)
assert isinstance(
solvers := solvers_api.list_solvers_releases(), list
)
for solver in solvers:
assert isinstance(solver, osparc.Solver)
assert (id_ := solver.id) is not None
assert (version := solver.version) is not None
for job in solvers_api.jobs(id_, version):
assert isinstance(job, osparc.Job)
solvers_api.delete_job(id_, version, job.id)
try:
for attempt in Retrying(
retry=retry_if_exception_type((osparc.ApiException, Urllib3HttpError)),
stop=stop_after_delay(timedelta(minutes=retry_minutes))
if retry_minutes
else stop_after_attempt(1),
):
with attempt:
with osparc.ApiClient(config) as api_client:
solvers_api = osparc.SolversApi(api_client)
assert isinstance(
solvers := solvers_api.list_solvers_releases(), list
)
for solver in solvers:
assert isinstance(solver, osparc.Solver)
assert (id_ := solver.id) is not None
assert (version := solver.version) is not None
for job in solvers_api.jobs(id_, version):
assert isinstance(job, osparc.Job)
solvers_api.delete_job(id_, version, job.id)
except RetryError as exc:
typer.echo(
typer.style(
(
"Failed when cleaning jobs when encountering "
f"the following exception:\n{exc.last_attempt.exception()}"
),
fg=typer.colors.RED,
bold=True,
)
)
bisgaard-itis marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions clients/python/test/e2e/test_files_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import osparc
import pytest
from _utils import requires_dev_features
from _utils import skip_if_no_dev_features
from conftest import _KB


Expand All @@ -19,7 +19,7 @@ def _hash_file(file: Path) -> str:
return sha256.hexdigest()


@requires_dev_features
@skip_if_no_dev_features
def test_upload_file(tmp_file: Path, api_client: osparc.ApiClient) -> None:
"""Test that we can upload a file via the multipart upload"""
tmp_path: Path = tmp_file.parent
Expand All @@ -37,7 +37,7 @@ def test_upload_file(tmp_file: Path, api_client: osparc.ApiClient) -> None:
files_api.delete_file(uploaded_file1.id)


@requires_dev_features
@skip_if_no_dev_features
@pytest.mark.parametrize("use_checksum", [True, False])
@pytest.mark.parametrize("use_id", [True, False])
def test_search_files(
Expand Down
12 changes: 5 additions & 7 deletions clients/python/test/e2e/test_solvers_api.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import json

import osparc
from _utils import requires_dev_features
from _utils import skip_if_no_dev_features, skip_if_osparc_version
from httpx import AsyncClient
from packaging.version import Version

DEFAULT_TIMEOUT_SECONDS = 10 * 60 # 10 min


@requires_dev_features
@skip_if_no_dev_features
def test_jobs(api_client: osparc.ApiClient, sleeper: osparc.Solver):
"""Test the jobs method

Expand Down Expand Up @@ -48,14 +49,11 @@ def test_jobs(api_client: osparc.ApiClient, sleeper: osparc.Solver):
solvers_api.delete_job(sleeper.id, sleeper.version, elm)


@skip_if_osparc_version(at_least=Version("0.6.5"))
async def test_logstreaming(
api_client: osparc.ApiClient, sleeper: osparc.Solver, async_client: AsyncClient
):
"""Test the log streaming

Args:
configuration (osparc.Configuration): The Configuration
"""
"""Test log streaming"""
solvers_api: osparc.SolversApi = osparc.SolversApi(api_client)
job: osparc.Job = solvers_api.create_job(
sleeper.id, sleeper.version, osparc.JobInputs({"input1": 1.0})
Expand Down
Loading