Skip to content

Commit

Permalink
Correctly merge in upstream testing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsf9k committed Jul 28, 2023
1 parent a616ae6 commit 0c45c44
Showing 1 changed file with 6 additions and 36 deletions.
42 changes: 6 additions & 36 deletions tests/container_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,40 @@ def test_container_count(dockerc):
), "Wrong number of containers were started."


<<<<<<< HEAD
# TODO: Implement this test. See cisagov/guacscanner-docker#3 for
# more details.
# def test_wait_for_ready(main_container):
# """Wait for container to be ready."""
# TIMEOUT = 10
# for i in range(TIMEOUT):
# if READY_MESSAGE in main_container.logs().decode("utf-8"):
# if READY_MESSAGE in main_container.logs():
# break
# time.sleep(1)
# else:
# raise Exception(
# f"Container does not seem ready. "
# f'Expected "{READY_MESSAGE}" in the log within {TIMEOUT} seconds.'
# )
=======
def test_wait_for_ready(main_container):
"""Wait for container to be ready."""
TIMEOUT = 10
for i in range(TIMEOUT):
if READY_MESSAGE in main_container.logs():
break
time.sleep(1)
else:
raise Exception(
f"Container does not seem ready. "
f'Expected "{READY_MESSAGE}" in the log within {TIMEOUT} seconds.'
)
>>>>>>> a9d6c92ea3ca2760e4a18276d06c668058dd3670


def test_wait_for_exits(dockerc, main_container, version_container):
"""Wait for containers to exit."""
<<<<<<< HEAD
# assert main_container.wait() == 0, "Container service (main) did not exit cleanly"
assert (
main_container.wait() == 1
dockerc.wait(main_container.id) == 1
), "Container service (main) did not exit as expected"
=======
>>>>>>> a9d6c92ea3ca2760e4a18276d06c668058dd3670
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"


<<<<<<< HEAD
# TODO: Implement this test. See cisagov/guacscanner-docker#3 for
# more details.
# def test_output(main_container):
# def test_output(dockerc, main_container):
# """Verify the container had the correct output."""
# main_container.wait() # make sure container exited if running test isolated
# log_output = main_container.logs().decode("utf-8")
# # 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."
=======
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(
Expand Down

0 comments on commit 0c45c44

Please sign in to comment.