diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 89b5d62..de871e0 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -81,5 +81,4 @@ jobs: UPPERCASE_RELEASE=${LOWERCASE_RELEASE^} docker tag ${{ env.IMAGE_BASE_NAME }}:${MATLAB_RELEASE} ${{ env.IMAGE_BASE_NAME }}:${LOWERCASE_RELEASE} docker tag ${{ env.IMAGE_BASE_NAME }}:${MATLAB_RELEASE} ${{ env.IMAGE_BASE_NAME }}:${UPPERCASE_RELEASE} - docker push ${{ env.IMAGE_BASE_NAME }}:${LOWERCASE_RELEASE} - docker push ${{ env.IMAGE_BASE_NAME }}:${UPPERCASE_RELEASE} + docker push --all-tags ${{ env.IMAGE_BASE_NAME }} diff --git a/.github/workflows/non-interactive-build-test.yml b/.github/workflows/non-interactive-build-test.yml index e479a2c..ee6dc3f 100644 --- a/.github/workflows/non-interactive-build-test.yml +++ b/.github/workflows/non-interactive-build-test.yml @@ -81,5 +81,4 @@ jobs: UPPERCASE_RELEASE=${LOWERCASE_RELEASE^} docker tag ${{ env.IMAGE_BASE_NAME }}:${MATLAB_RELEASE} ${{ env.IMAGE_BASE_NAME }}:${LOWERCASE_RELEASE} docker tag ${{ env.IMAGE_BASE_NAME }}:${MATLAB_RELEASE} ${{ env.IMAGE_BASE_NAME }}:${UPPERCASE_RELEASE} - docker push ${{ env.IMAGE_BASE_NAME }}:${LOWERCASE_RELEASE} - docker push ${{ env.IMAGE_BASE_NAME }}:${UPPERCASE_RELEASE} + docker push --all-tags ${{ env.IMAGE_BASE_NAME }} diff --git a/tests/alternates/building-on-matlab-docker-image/test_entrypoint.py b/tests/alternates/building-on-matlab-docker-image/test_entrypoint.py index 12d8fad..f11ef68 100644 --- a/tests/alternates/building-on-matlab-docker-image/test_entrypoint.py +++ b/tests/alternates/building-on-matlab-docker-image/test_entrypoint.py @@ -8,6 +8,7 @@ from utils import helpers import docker +import pexpect import testinfra import unittest @@ -44,13 +45,15 @@ def test_no_entry_option(self): expected_login_msg = ( "Please enter your MathWorks Account email address and press Enter:" ) - self.container = self.client.containers.run( + self.container = self.client.containers.create( image=self.image_name, - detach=True, stdin_open=True, + tty=True, ) - helpers.wait_for_msg_in_log(self.container, expected_login_msg) - self.assertIn(expected_login_msg, self.container.logs(tail=1).decode()) + self.child = pexpect.spawn(f"docker start -i {self.container.id}") + self.child.expect(expected_login_msg) + output = self.child.after.decode().strip() + self.assertIn(expected_login_msg.lower(), output.lower()) def test_shell_option(self): """Test that if the '-shell' option is specified, then a '/bin/bash' process is started""" @@ -142,20 +145,6 @@ def test_batch_option(self): self.assertGreater(len(host.process.filter(user="matlab", comm="MATLAB")), 0) - def test_custom_option(self): - """Test that if a custom option is specified, the custom command is run in bash.""" - custom_option = "pwd" - expected_output = "/home/matlab" - - self.container = self.client.containers.run( - image=self.image_name, - detach=True, - command=custom_option, - ) - self.container.wait() - - self.assertEqual(self.container.logs().decode().strip(), expected_output) - ################################################################################ diff --git a/tests/requirements.txt b/tests/requirements.txt index 6993704..e8acddc 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,4 +2,5 @@ docker markdown-it-py +pexpect pytest-testinfra diff --git a/tests/utils/helpers.py b/tests/utils/helpers.py index 5ef7839..fd6fc87 100644 --- a/tests/utils/helpers.py +++ b/tests/utils/helpers.py @@ -121,12 +121,15 @@ def wait_for_msg_in_log(container, msg, timeout=30): """Wait until the expected log message is printed to stdout""" def msg_is_logged(): - return msg in container.logs().decode() + return msg.lower() in container.logs().decode().lower() try: wait_for(msg_is_logged, timeout) except TimeoutError: - raise RuntimeError(f"The message {msg} was not printed to stdout.") + output = container.logs().decode() + raise RuntimeError( + f"The message\n\n\t'{msg}'\n\nwas not printed to stdout:\n\n{output}" + ) def wait_for_container_status(client, id, status, timeout=30):