Skip to content

Commit 14be4d5

Browse files
authored
Merge branch 'master' into is7399/list-projects-rpc-api-server
2 parents 42a344e + 3db0e34 commit 14be4d5

File tree

5 files changed

+72
-42
lines changed

5 files changed

+72
-42
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
⬆️ Upgrade dependencies.
1111
📝 Add or update documentation.
1212
🔨 Add or update development scripts.
13+
✅ Add, update or pass tests.
1314
🔒️ Fix security issues.
1415
⚠️ Changes in ops configuration etc. are required before deploying.
1516
[ Please add a link to the associated ops-issue or PR, such as in https://github.com/ITISFoundation/osparc-ops-environments or https://git.speag.com/oSparc/osparc-infra ]
@@ -28,32 +29,16 @@ or from https://gitmoji.dev/
2829

2930

3031
## Related issue/s
31-
32-
<!-- Link pull request to an issue
33-
SEE https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
34-
35-
- resolves ITISFoundation/osparc-issues#428
36-
- fixes #26
37-
-->
32+
<!-- LINK to other issues and add prefix `closes`, `fixes`, `resolves`-->
3833

3934

4035
## How to test
4136

4237
<!-- Give REVIEWERS some hits or code snippets on how could this be tested -->
4338

44-
## Dev-ops checklist
45-
46-
- [ ] No ENV changes or I properly updated ENV ([read the instruction](https://git.speag.com/oSparc/osparc-ops-deployment-configuration/-/blob/configs/README.md?ref_type=heads#how-to-update-env-variables))
47-
48-
<!-- Some checks that might help your code run stable on production, and help devops assess criticality.
49-
Modified from https://oschvr.com/posts/what-id-like-as-sre/
39+
## Dev-ops
5040

51-
- How can DevOps check the health of the service ?
52-
- How can DevOps safely and gracefully restart the service ?
53-
- How and why would this code fail ?
54-
- What kind of metrics are you exposing ?
55-
- Is there any documentation/design specification for the service ?
56-
- How (e.g. through which loglines) can DevOps detect unexpected situations that require escalation to human ?
57-
- What are the resource limitations (CPU, RAM) expected for this service ?
58-
- Are all relevant variables documented and adjustable via environment variables (i.e. no hardcoded magic numbers) ?
41+
<!--
42+
- No changes /updated ENV. SEE https://git.speag.com/oSparc/osparc-ops-deployment-configuration/-/blob/configs/README.md?ref_type=heads#how-to-update-env-variables)
43+
- SEE docs/devops-checklist.md
5944
-->

docs/devops-checklist.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Devops checklist
2+
3+
- No ENV changes or I properly updated ENV ([read the instruction](https://git.speag.com/oSparc/osparc-ops-deployment-configuration/-/blob/configs/README.md?ref_type=heads#how-to-update-env-variables))
4+
5+
- Some checks that might help your code run stable on production, and help devops assess criticality.
6+
- How can DevOps check the health of the service ?
7+
- How can DevOps safely and gracefully restart the service ?
8+
- How and why would this code fail ?
9+
- What kind of metrics are you exposing ?
10+
- Is there any documentation/design specification for the service ?
11+
- How (e.g. through which loglines) can DevOps detect unexpected situations that require escalation to human ?
12+
- What are the resource limitations (CPU, RAM) expected for this service ?
13+
- Are all relevant variables documented and adjustable via environment variables (i.e. no hardcoded magic numbers) ?
14+
15+
Ref: Modified from https://oschvr.com/posts/what-id-like-as-sre/

packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def __call__(self, message: str) -> None:
319319

320320

321321
_FAIL_FAST_DYNAMIC_SERVICE_STATES: Final[tuple[str, ...]] = ("idle", "failed")
322-
_SERVICE_ROOT_POINT_STATUS_TIMEOUT: Final[timedelta] = timedelta(seconds=5)
322+
_SERVICE_ROOT_POINT_STATUS_TIMEOUT: Final[timedelta] = timedelta(seconds=30)
323323

324324

325325
def _get_service_url(

services/web/server/tests/unit/with_dbs/04/studies_dispatcher/test_studies_dispatcher_studies_access.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,24 @@ async def _assert_redirected_to_study(
234234
"OSPARC-SIMCORE" in content
235235
), f"Expected front-end rendering workbench's study, got {content!s}"
236236

237-
# Expects fragment to indicate client where to find newly created project
238-
m = re.match(r"/study/([\d\w-]+)", response.real_url.fragment)
239-
assert m, f"Expected /study/uuid, got {response.real_url.fragment}"
237+
# First check if the fragment indicates an error
238+
fragment = response.real_url.fragment
239+
error_match = re.match(r"/error", fragment)
240+
if error_match:
241+
# Parse query parameters to extract error details
242+
query_params = urllib.parse.parse_qs(
243+
fragment.split("?", 1)[1] if "?" in fragment else ""
244+
)
245+
error_message = query_params.get("message", ["Unknown error"])[0]
246+
error_status = query_params.get("status_code", ["Unknown"])[0]
247+
248+
pytest.fail(
249+
f"Redirected to error page: Status={error_status}, Message={error_message}"
250+
)
251+
252+
# Check for study path if not an error
253+
m = re.match(r"/study/([\d\w-]+)", fragment)
254+
assert m, f"Expected /study/uuid, got {fragment}"
240255

241256
# Expects auth cookie for current user
242257
assert _is_user_authenticated(session)
@@ -435,7 +450,17 @@ async def enforce_garbage_collect_guest(uid):
435450

436451

437452
@pytest.mark.flaky(max_runs=3)
438-
@pytest.mark.parametrize("number_of_simultaneous_requests", [1, 2, 32])
453+
@pytest.mark.parametrize(
454+
"number_of_simultaneous_requests",
455+
[
456+
1,
457+
2,
458+
16,
459+
# NOTE: The number of simultaneous anonymous users is limited by system load.
460+
# A GuestUsersLimitError is raised if user creation exceeds the MAX_DELAY_TO_CREATE_USER threshold.
461+
# This test is flaky due to its dependency on app runtime conditions. Avoid increasing simultaneous requests.
462+
],
463+
)
439464
async def test_guest_user_is_not_garbage_collected(
440465
number_of_simultaneous_requests: int,
441466
web_server: TestServer,
@@ -454,9 +479,6 @@ async def test_guest_user_is_not_garbage_collected(
454479

455480
async def _test_guest_user_workflow(request_index):
456481
print("request #", request_index, "-" * 10)
457-
458-
# TODO: heartbeat is missing here!
459-
# TODO: reduce GC activation period to 0.1 secs
460482
# every guest uses different client to preserve it's own authorization/authentication cookies
461483
client: TestClient = await aiohttp_client(web_server)
462484
assert client.app
@@ -495,5 +517,4 @@ async def _test_guest_user_workflow(request_index):
495517
]
496518

497519
await asyncio.gather(*request_tasks)
498-
499520
# and now the garbage collector shall delete our users since we are done...

tests/e2e-playwright/tests/tip/test_ti_plan.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,17 @@ def test_classic_ti_plan( # noqa: PLR0915
236236
assert not ws_info.value.is_closed()
237237
restartable_jlab_websocket = RobustWebSocket(page, ws_info.value)
238238

239-
with log_context(logging.INFO, "Run optimization") as ctx:
239+
with log_context(logging.INFO, "Run optimization") as ctx2:
240240
run_button = ti_iframe.get_by_role("button", name="Run Optimization")
241241
run_button.click(timeout=_JLAB_RUN_OPTIMIZATION_APPEARANCE_TIME)
242242
try:
243243
_wait_for_optimization_complete(run_button)
244-
ctx.logger.info("Optimization finished!")
244+
ctx2.logger.info("Optimization finished!")
245245
except RetryError as e:
246246
last_exc = e.last_attempt.exception()
247-
ctx.logger.warning(f"Optimization did not finish in time: {last_exc}")
247+
ctx2.logger.warning(
248+
"Optimization did not finish in time: %s", f"{last_exc}"
249+
)
248250

249251
with log_context(logging.INFO, "Create report"):
250252
with log_context(
@@ -262,16 +264,23 @@ def test_classic_ti_plan( # noqa: PLR0915
262264

263265
if is_product_lite:
264266
assert (
265-
not ti_iframe.get_by_role("button", name="Add to Report (0)")
267+
ti_iframe.get_by_role("button", name="Add to Report (0)")
266268
.nth(0)
267-
.is_enabled()
268-
)
269-
assert not ti_iframe.get_by_role(
270-
"button", name="Export to S4L"
271-
).is_enabled()
272-
assert not ti_iframe.get_by_role(
273-
"button", name="Export Report"
274-
).is_enabled()
269+
.get_attribute("disabled")
270+
is not None
271+
), "Add to Report button should be disabled in lite product"
272+
assert (
273+
ti_iframe.get_by_role("button", name="Export to S4L").get_attribute(
274+
"disabled"
275+
)
276+
is not None
277+
), "Export to S4L button should be disabled in lite product"
278+
assert (
279+
ti_iframe.get_by_role("button", name="Export Report").get_attribute(
280+
"disabled"
281+
)
282+
is not None
283+
), "Export Report button should be disabled in lite product"
275284

276285
else:
277286
with log_context(

0 commit comments

Comments
 (0)