Skip to content

chore: make selenium container management more reliable#2603

Merged
ssbarnea merged 1 commit intomainfrom
chore/selenium
Feb 19, 2026
Merged

chore: make selenium container management more reliable#2603
ssbarnea merged 1 commit intomainfrom
chore/selenium

Conversation

@ssbarnea
Copy link
Member

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make the Selenium-based UI test container lifecycle more reliable by introducing explicit container health checks and centralized container naming, while also moving Selenium pytest CLI options from pyproject.toml into the ui-selenium Taskfile task.

Changes:

  • Add Podman healthcheck-based startup gating for the Selenium container and reuse a shared CONTAINER_NAME constant.
  • Adjust Selenium test execution defaults by simplifying [tool.pytest].addopts and moving coverage/junit args into task ui-selenium.
  • Minor test/logging tweaks (logger names and disabling a flaky marker via commenting).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/selenium/utils/settings_utils.py Switch logger naming to use __package__.
test/selenium/ui/test_lightspeed.py Comment out the pytest.mark.flaky decorator for one test.
test/selenium/fixtures/ui_fixtures.py Add container healthcheck gating and restart logic before creating Remote WebDriver.
test/selenium/const.py Introduce CONTAINER_NAME = "selenium-vscode".
test/selenium/conftest.py Use shared container name; adjust logging format; change teardown to stop container and capture stats output.
pyproject.toml Simplify pytest addopts to reduce IDE/console friction; remove UI-selenium-specific options.
Taskfile.yml Make task ui-selenium explicitly pass coverage/junit args to pytest instead of relying on pyproject.toml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{{.CLI_ARGS}}
# --reruns-delay=120
# --reruns=3
- defer: podman-compose down
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task still uses defer: podman-compose down, but the new test teardown comments note that podman-compose down can fail intermittently. To avoid CI flakes from teardown, consider making this teardown non-fatal (e.g., podman-compose down || true) or switching it to the same podman stop ${CONTAINER_NAME} approach used in the pytest session teardown.

Suggested change
- defer: podman-compose down
- defer: podman-compose down || true

Copilot uses AI. Check for mistakes.
Comment on lines +80 to +88
count = 0
while True:
if is_container_healthy():
break
count += 1
time.sleep(1)
log.info(
"Waiting for container %s to be healthy: %s", CONTAINER_NAME, count
)
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wait loop for container health has no timeout (while True) and will hang the entire test session indefinitely if the container never becomes healthy (e.g., image pull issues, healthcheck misconfig, podman errors). Add a max wait/retry limit and fail fast with a clear error that includes relevant diagnostics (e.g., last healthcheck stdout/stderr, podman logs, podman inspect health status).

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +105
result = subprocess.run(
f"podman stop {CONTAINER_NAME} 2>/dev/null || true",
# Apparently compose down can fail with various errors but stopping container works
# "podman-compose down",
capture_output=True,
check=False,
shell=True,
text=True,
)
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman stop ... || true forces a zero exit code even when podman stop fails, so if result.returncode != 0: will never trigger and failures to stop the container will be silently ignored. Remove the || true (and rely on check=False) or explicitly handle the "no such container" case so real stop failures can be detected/logged.

Copilot uses AI. Check for mistakes.
@ssbarnea ssbarnea disabled auto-merge February 19, 2026 14:50
@ssbarnea ssbarnea merged commit d671f2d into main Feb 19, 2026
16 checks passed
@ssbarnea ssbarnea deleted the chore/selenium branch February 19, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant

Comments