Skip to content

Commit 929a283

Browse files
Copilotrnovatorov
andcommitted
Fix integration tests timeout by pre-pulling Docker image
- Add Docker image pre-pull step to CI workflow before running tests - Add explicit image pull with error handling in test fixtures - Remove CI skip condition for integration tests - Improve error messages for Docker-related failures Co-authored-by: rnovatorov <20299819+rnovatorov@users.noreply.github.com>
1 parent d6addbd commit 929a283

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: Install dependencies
2828
run: make install-deps
2929

30+
- name: Pull Docker images for integration tests
31+
run: docker pull eclipse-mosquitto:latest
32+
3033
- name: Run checks
3134
run: make check
3235

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ test-unit:
4242

4343
.PHONY: test-integration
4444
test-integration:
45-
# TODO: Figure out why integration tests time out in CI environment.
46-
ifdef CI
47-
$(warning skipping integration tests in CI environment)
48-
else
4945
pipenv run pytest -vv --capture=no tests/integration
50-
endif
5146

5247
.PHONY: get-pipenv
5348
get-pipenv:

tests/integration/conftest.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ def fixture_mosquitto_container(
3232
docker_client: docker.DockerClient,
3333
) -> Generator[docker.models.containers.Container, None, None]:
3434
name = "enapter-python-sdk-integration-tests-mosquitto"
35+
image = os.getenv("MOSQUITTO_IMAGE", "eclipse-mosquitto:latest")
36+
37+
# Ensure the image is available locally
38+
try:
39+
docker_client.images.get(image)
40+
except docker.errors.ImageNotFound:
41+
# Pull the image if not available locally
42+
# This is handled by the CI workflow, but we keep it here for local testing
43+
try:
44+
docker_client.images.pull(image)
45+
except docker.errors.APIError as e:
46+
raise RuntimeError(
47+
f"Failed to pull Docker image {image}. "
48+
f"Please ensure Docker is running and you have network connectivity. "
49+
f"Error: {e}"
50+
) from e
3551

3652
try:
3753
old_mosquitto = docker_client.containers.get(name)
@@ -41,7 +57,7 @@ def fixture_mosquitto_container(
4157
old_mosquitto.remove(force=True)
4258

4359
mosquitto = docker_client.containers.run(
44-
os.getenv("MOSQUITTO_IMAGE", "eclipse-mosquitto:latest"),
60+
image,
4561
["mosquitto", "-c", "/mosquitto-no-auth.conf"],
4662
name=name,
4763
network="bridge",

0 commit comments

Comments
 (0)