diff --git a/bci_tester/data.py b/bci_tester/data.py index 08349a31..7ad0dc24 100755 --- a/bci_tester/data.py +++ b/bci_tester/data.py @@ -487,6 +487,25 @@ def create_BCI( volume_mounts=[ContainerVolume(container_path="/var/lib/docker-registry")], ) +GIT_CONTAINER = create_BCI( + build_tag=f"{APP_CONTAINER_PREFIX}/git:latest", + bci_type=ImageType.APPLICATION, + image_type="kiwi", +) + +HELM_CONTAINER = create_BCI( + build_tag=f"{APP_CONTAINER_PREFIX}/helm:latest", + bci_type=ImageType.APPLICATION, + custom_entry_point="/bin/sh", + image_type="kiwi", +) + +NGINX_CONTAINER = create_BCI( + build_tag=f"{APP_CONTAINER_PREFIX}/nginx:latest", + bci_type=ImageType.APPLICATION, + forwarded_ports=[PortForwarding(container_port=80)], +) + DOTNET_CONTAINERS = [ DOTNET_SDK_6_0_CONTAINER, DOTNET_SDK_7_0_CONTAINER, @@ -502,6 +521,7 @@ def create_BCI( OPENJDK_DEVEL_11_CONTAINER, OPENJDK_17_CONTAINER, OPENJDK_DEVEL_17_CONTAINER, + NGINX_CONTAINER, NODEJS_16_CONTAINER, NODEJS_18_CONTAINER, NODEJS_20_CONTAINER, @@ -524,6 +544,8 @@ def create_BCI( MINIMAL_CONTAINER, MICRO_CONTAINER, BUSYBOX_CONTAINER, + HELM_CONTAINER, + GIT_CONTAINER, DISTRIBUTION_CONTAINER, ] @@ -533,6 +555,7 @@ def create_BCI( BASE_CONTAINER, MINIMAL_CONTAINER, MICRO_CONTAINER, + GIT_CONTAINER, INIT_CONTAINER, BUSYBOX_CONTAINER, OPENJDK_11_CONTAINER, diff --git a/pyproject.toml b/pyproject.toml index c8094665..557c2ebb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,9 @@ markers = [ 'dotnet-sdk_5.0', 'dotnet-sdk_6.0', 'dotnet-sdk_7.0', + 'git_latest', + 'helm_latest', + 'nginx_latest', 'golang_1.19', 'golang_1.20', 'golang_oldstable', diff --git a/tests/test_all.py b/tests/test_all.py index be0e3f8d..af951c96 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -43,6 +43,7 @@ RUN go build main.go FROM $runner +ENTRYPOINT [] WORKDIR /fetcher/ COPY --from=builder /src/main . CMD ["/fetcher/main"] @@ -195,7 +196,7 @@ def test_certificates_are_present( """This is a multistage container build, verifying that the certificates are correctly set up in the containers. - In the first step, we build a very simple go binary from + In the first step, we build a go binary from :py:const:`FETCH_SUSE_DOT_COM` in the golang container. We copy the resulting binary into the container under test and execute it in that container. diff --git a/tests/test_git.py b/tests/test_git.py new file mode 100644 index 00000000..88c591d2 --- /dev/null +++ b/tests/test_git.py @@ -0,0 +1,15 @@ +from pytest_container.runtime import LOCALHOST + +from bci_tester.data import GIT_CONTAINER + + +CONTAINER_IMAGES = (GIT_CONTAINER,) + + +def test_git_version(auto_container, host): + assert ( + "git version 2." + in auto_container.connection.run_expect( + [0], "git --version" + ).stdout.strip() + ) diff --git a/tests/test_helm.py b/tests/test_helm.py new file mode 100644 index 00000000..f404c51b --- /dev/null +++ b/tests/test_helm.py @@ -0,0 +1,16 @@ +from pytest_container.runtime import LOCALHOST + +from bci_tester.data import HELM_CONTAINER + + +CONTAINER_IMAGES = (HELM_CONTAINER,) + + +def test_helm_version(auto_container, host, container_runtime): + assert ( + "GitTreeState" + in host.run_expect( + [0], + f"{container_runtime.runner_binary} run --rm {auto_container.image_url_or_id} version", + ).stdout.strip() + ) diff --git a/tests/test_metadata.py b/tests/test_metadata.py index aa6ade02..d0582beb 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -34,12 +34,15 @@ from bci_tester.data import DOTNET_RUNTIME_7_0_CONTAINER from bci_tester.data import DOTNET_SDK_6_0_CONTAINER from bci_tester.data import DOTNET_SDK_7_0_CONTAINER +from bci_tester.data import GIT_CONTAINER from bci_tester.data import GOLANG_CONTAINERS +from bci_tester.data import HELM_CONTAINER from bci_tester.data import ImageType from bci_tester.data import INIT_CONTAINER from bci_tester.data import L3_CONTAINERS from bci_tester.data import MICRO_CONTAINER from bci_tester.data import MINIMAL_CONTAINER +from bci_tester.data import NGINX_CONTAINER from bci_tester.data import NODEJS_16_CONTAINER from bci_tester.data import NODEJS_18_CONTAINER from bci_tester.data import NODEJS_20_CONTAINER @@ -125,6 +128,9 @@ def _get_container_label_prefix( (PHP_8_APACHE, "php-apache", ImageType.LANGUAGE_STACK), (PHP_8_CLI, "php", ImageType.LANGUAGE_STACK), (PHP_8_FPM, "php-fpm", ImageType.LANGUAGE_STACK), + (GIT_CONTAINER, "git", ImageType.APPLICATION), + (HELM_CONTAINER, "helm", ImageType.APPLICATION), + (NGINX_CONTAINER, "nginx", ImageType.APPLICATION), ] + [ (container_389ds, "389-ds", ImageType.APPLICATION) diff --git a/tests/test_nginx.py b/tests/test_nginx.py new file mode 100644 index 00000000..adfd7254 --- /dev/null +++ b/tests/test_nginx.py @@ -0,0 +1,14 @@ +from pytest_container.runtime import LOCALHOST + +from bci_tester.data import NGINX_CONTAINER + + +CONTAINER_IMAGES = (NGINX_CONTAINER,) + + +def test_nginx_welcome_page(auto_container, host): + host_port = auto_container.forwarded_ports[0].host_port + + assert "Welcome to nginx" in host.check_output( + f"curl -sf --retry 5 --retry-connrefused http://localhost:{host_port}/" + )