From 411f25ae5c5b9f36c12606b1743f2161bd63c563 Mon Sep 17 00:00:00 2001 From: Jeremy Frasier Date: Fri, 28 Jul 2023 11:05:51 -0400 Subject: [PATCH] Correctly merge in upstream testing changes --- tests/conftest.py | 13 ------------ tests/container_test.py | 46 ----------------------------------------- 2 files changed, 59 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 84e70ff..9f5a806 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,19 +24,6 @@ def main_container(dockerc): return dockerc.compose.ps(services=[MAIN_SERVICE_NAME], all=True)[0] -<<<<<<< HEAD -======= -@pytest.fixture(scope="session") -def version_container(dockerc): - """Return the version container from the Docker composition. - - The version container should just output the version of its underlying contents. - """ - # find the container by name even if it is stopped already - return dockerc.compose.ps(services=[VERSION_SERVICE_NAME], all=True)[0] - - ->>>>>>> a9d6c92ea3ca2760e4a18276d06c668058dd3670 def pytest_addoption(parser): """Add new commandline options to pytest.""" parser.addoption( diff --git a/tests/container_test.py b/tests/container_test.py index 9aa8dbc..90adfe5 100644 --- a/tests/container_test.py +++ b/tests/container_test.py @@ -29,11 +29,7 @@ def test_container_count(dockerc): """Verify the test composition and container.""" # stopped parameter allows non-running containers in results assert ( -<<<<<<< HEAD - len(dockerc.containers(stopped=False)) == 1 -======= len(dockerc.compose.ps(all=True)) == 2 ->>>>>>> a9d6c92ea3ca2760e4a18276d06c668058dd3670 ), "Wrong number of containers were started." @@ -51,7 +47,6 @@ def test_wait_for_ready(main_container): ) -<<<<<<< HEAD @pytest.mark.parametrize("port", [1025, 1587]) @pytest.mark.parametrize("to_user", [ARCHIVE_USER, TEST_SEND_USER]) def test_sending_mail(port, to_user): @@ -161,24 +156,6 @@ def test_imap_messages_cleared(username, password): message_count = int(data[0]) print(f"inbox message count: {message_count}") assert message_count == 0, "Expected the inbox to be empty" -======= -def test_wait_for_exits(dockerc, main_container, version_container): - """Wait for containers to exit.""" - assert ( - dockerc.wait(main_container.id) == 0 - ), "Container service (main) did not exit cleanly" - assert ( - dockerc.wait(version_container.id) == 0 - ), "Container service (version) did not exit cleanly" - - -def test_output(dockerc, main_container): - """Verify the container had the correct output.""" - # make sure container exited if running test isolated - dockerc.wait(main_container.id) - log_output = main_container.logs() - assert SECRET_QUOTE in log_output, "Secret not found in log output." ->>>>>>> a9d6c92ea3ca2760e4a18276d06c668058dd3670 @pytest.mark.skipif( @@ -195,35 +172,12 @@ def test_release_version(): ), "RELEASE_TAG does not match the project version" -<<<<<<< HEAD def test_container_version_label_matches(main_container): -======= -def test_log_version(dockerc, version_container): - """Verify the container outputs the correct version to the logs.""" - # make sure container exited if running test isolated - dockerc.wait(version_container.id) - log_output = version_container.logs().strip() - pkg_vars = {} - with open(VERSION_FILE) as f: - exec(f.read(), pkg_vars) # nosec - project_version = pkg_vars["__version__"] - assert ( - log_output == project_version - ), f"Container version output to log does not match project version file {VERSION_FILE}" - - -def test_container_version_label_matches(version_container): ->>>>>>> a9d6c92ea3ca2760e4a18276d06c668058dd3670 """Verify the container version label is the correct version.""" pkg_vars = {} with open(VERSION_FILE) as f: exec(f.read(), pkg_vars) # nosec project_version = pkg_vars["__version__"] assert ( -<<<<<<< HEAD main_container.labels["org.opencontainers.image.version"] == project_version -======= - version_container.config.labels["org.opencontainers.image.version"] - == project_version ->>>>>>> a9d6c92ea3ca2760e4a18276d06c668058dd3670 ), "Dockerfile version label does not match project version"