Skip to content

Commit 591fd79

Browse files
committed
docker project specified for local integration testing
1 parent a88a76b commit 591fd79

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/test_integration.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
import docker
88
from minio import Minio
9-
9+
import uuid
1010

1111
@pytest.fixture(scope="session")
1212
def docker_client():
@@ -17,8 +17,11 @@ def docker_client():
1717
def docker_compose(docker_client):
1818
"""Start Docker Compose before tests, shut down after."""
1919
print("Starting Docker Compose...")
20+
21+
PROJECT = f"test_{uuid.uuid4().hex}"
22+
2023
subprocess.run(
21-
["docker", "compose", "-f", "docker-compose-develop.yml", "up", "-d"],
24+
["docker", "compose", "-f", "docker-compose-develop.yml", "-p", PROJECT, "up", "-d"],
2225
check=True
2326
)
2427
time.sleep(10) # Wait for services to start — adjust as needed
@@ -35,7 +38,7 @@ def docker_compose(docker_client):
3538
print(logs)
3639

3740
print("Stopping Docker Compose...")
38-
subprocess.run(["docker", "compose", "down"], check=True)
41+
subprocess.run(["docker", "compose", "-p", PROJECT, "down", "-v"], check=True)
3942

4043

4144
def load_test_data_into_minio():
@@ -50,9 +53,7 @@ def load_test_data_into_minio():
5053
bucket_name = "ro-crates"
5154
test_data_dir = "tests/data/ro_crates"
5255

53-
# Ensure bucket exists
54-
if not minio_client.bucket_exists(bucket_name):
55-
minio_client.make_bucket(bucket_name)
56+
minio_client.make_bucket(bucket_name)
5657

5758
# Walk and upload files
5859
for root, _, files in os.walk(test_data_dir):

0 commit comments

Comments
 (0)