Skip to content

Commit

Permalink
replace test resource file by fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki committed Oct 20, 2023
1 parent 3f9fd47 commit ae35521
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions test/integration/test_container/Dockerfile

This file was deleted.

6 changes: 4 additions & 2 deletions test/integration/test_install_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import tempfile

import requests
import shutil
import time
from pathlib import Path
from inspect import cleandoc
Expand All @@ -19,11 +20,12 @@
TEST_CONTAINER_NAME = "ansible-test"
TEST_CONTAINER_IMAGE_TAG = "data_science_sandbox_test_container:latest"

# AWS AMI Image is based on Ubuntu20.04 server.
# So we try to simulate same environment here.
DOCKERFILE_CONTENT = cleandoc(
"""
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND noninteractive
#AWS AMI Image is based on Ubuntu20.04 server. So we try to simulate same environment here
RUN apt-get update && apt-get install -y ubuntu-server
"""
)
Expand All @@ -34,13 +36,13 @@ def dockerfile(tmp_path_factory):
with dockerfile.open("w") as f:
print(DOCKERFILE_CONTENT, file = f)
yield dockerfile
shutil.rmtree(str(dockerfile.parent))


@pytest.fixture(scope="session")
def docker_test_container(test_config, dockerfile):
with tempfile.TemporaryDirectory() as tmp_path:
docker_env = docker.from_env()
# p = Path(__file__).parent / "test_container"
docker_env.images.build(
path=str(dockerfile.parent),
tag=TEST_CONTAINER_IMAGE_TAG
Expand Down

0 comments on commit ae35521

Please sign in to comment.