Skip to content

Commit 92d089d

Browse files
152 improve client e2e tests (#153)
* update workflow before publishing python package * fix dependency issue and bump version * point to website in project description * fix broken dependency * improve doc * add github token to download artifacts * ensure only read-access @wvangeit * yet another attempt at downloading artifacts * make sure to use repo that ran the trigger wf * another attempt at fixing * change owner * allow publishing to testpypi also when pr * minor change * revert minor (but breaking) change * minor fix * add debug messages * another debug message * hopefully the final version * final fix * minor fix * move master and tag to individual jobs * add debug messages * dev->post * add python script for determining semantic version * minor changes * minor changes * improve error handling and add version file to artifacts * check if release * minor fix * ensure to enter venv * also when tagging * source venv in publishin workflow * ensure only master * add script for testing 'pure' semver * adapt workflows to new python script * minor change * attempt to evaluate expressions correctly * several fixes to fix tests * ensure repo is checked out in publish workflow * several small fixes * cleanup * debug * minor cleanup * mionr changes * add debug message * minor change * minor change * yet another try * minor change * minor change * minor change * mionr change * minor changes * correct workflow run id * cosmetic change * avoid using gh * change to a single job for publishing * minor cleanup * swap loops in clean up jobs * correction * update server compatibility to new url * minor change to trigger ci * improve name of skipping tests * improve naming * print html table * pretty print test result table * improve printing of html table * remove redudnant file * cosmetic change * improve table * @pcrespov dont cast generator to list
1 parent f9fb08e commit 92d089d

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

clients/python/test/e2e/ci/e2e/e2e/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class E2eExitCodes(IntEnum):
3535
"""
3636

3737
CI_SCRIPT_FAILURE = 100
38-
INCOMPATIBLE_CLIENT_SERVER = 101
38+
SKIPPING_TESTS = 101
3939
INVALID_JSON_DATA = 102
4040

4141

clients/python/test/e2e/ci/e2e/e2e/postprocess.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,20 @@ def single_testrun(exit_code: int) -> None:
111111

112112
@cli.command()
113113
@handle_validation_error
114-
def check_for_failure():
114+
def check_for_failure(e2e_artifacts_dir: str):
115115
"""Loop through all json artifacts and fail in case of testfailure"""
116-
pytest_ini: PytestIniFile = PytestIniFile.create_from_file()
117-
artifacts: Artifacts = pytest_ini.artifacts
118-
if not artifacts.log_dir.is_dir():
119-
raise typer.Exit(code=E2eExitCodes.CI_SCRIPT_FAILURE)
120-
result_jsons = list(Path(artifacts.artifact_dir).glob("*.json"))
121-
if not len(result_jsons):
116+
artifacts: Path = Path(e2e_artifacts_dir)
117+
if not artifacts.is_dir():
122118
raise typer.Exit(code=E2eExitCodes.CI_SCRIPT_FAILURE)
123-
for pth in result_jsons:
119+
count = 0
120+
for pth in artifacts.glob("*.json"):
121+
count += 1
124122
df = pd.read_json(pth)
125-
df = (df != pytest.ExitCode.OK) & (
126-
df != E2eExitCodes.INCOMPATIBLE_CLIENT_SERVER
127-
)
123+
df = (df != pytest.ExitCode.OK) & (df != E2eExitCodes.SKIPPING_TESTS)
128124
if df.to_numpy().flatten().any():
129125
raise typer.Exit(code=pytest.ExitCode.TESTS_FAILED)
126+
if count == 0:
127+
raise typer.Exit(code=E2eExitCodes.CI_SCRIPT_FAILURE)
130128

131129

132130
def _exitcode_to_text(exitcode: int) -> str:
@@ -141,7 +139,7 @@ def _exitcode_to_text(exitcode: int) -> str:
141139

142140
def _make_pretty(entry: str):
143141
color: str
144-
if entry == E2eExitCodes.INCOMPATIBLE_CLIENT_SERVER.name:
142+
if entry == E2eExitCodes.SKIPPING_TESTS.name:
145143
color = "#999999"
146144
elif entry == pytest.ExitCode.OK.name:
147145
color = "#99FF99"
@@ -185,6 +183,8 @@ def generate_html_table(e2e_artifacts_dir: str) -> None:
185183
s.set_table_styles(style)
186184
s.set_caption("OSPARC e2e python client vs server tests")
187185
s.to_html(artifacts / "test_results.html")
186+
df.rename_axis("OSPARC e2e python client vs server test")
187+
typer.echo(df.to_markdown(tablefmt="double_grid"))
188188

189189

190190
@cli.command()

clients/python/test/e2e/ci/e2e/e2e/preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ def check_compatibility() -> None:
116116
raise typer.Exit(code=E2eExitCodes.CI_SCRIPT_FAILURE)
117117

118118
if not is_compatible:
119-
raise typer.Exit(code=E2eExitCodes.INCOMPATIBLE_CLIENT_SERVER)
119+
raise typer.Exit(code=E2eExitCodes.SKIPPING_TESTS)
120120
else:
121121
raise typer.Exit(code=pytest.ExitCode.OK)

0 commit comments

Comments
 (0)