diff --git a/tests/integration/env-tests/README.md b/tests/integration/env-tests/README.md deleted file mode 100644 index b1c96cf..0000000 --- a/tests/integration/env-tests/README.md +++ /dev/null @@ -1,5 +0,0 @@ -running the following command should give myval2 - -``` -podman_compose run -l monkey -e ZZVAR1=myval2 env-test -``` diff --git a/tests/integration/test_podman_compose_env.py b/tests/integration/test_podman_compose_env.py new file mode 100644 index 0000000..2eb6d30 --- /dev/null +++ b/tests/integration/test_podman_compose_env.py @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0 + +import os +import unittest + +from tests.integration.test_podman_compose import podman_compose_path +from tests.integration.test_podman_compose import test_path +from tests.integration.test_utils import RunSubprocessMixin + + +def compose_yaml_path(): + return os.path.join(os.path.join(test_path(), "env-tests"), "container-compose.yml") + + +class TestComposeEnv(unittest.TestCase, RunSubprocessMixin): + """Test that inline environment variable overrides environment variable from compose file.""" + + def test_env(self): + try: + output, _ = self.run_subprocess_assert_returncode([ + podman_compose_path(), + "-f", + compose_yaml_path(), + "run", + "-l", + "monkey", + "-e", + "ZZVAR1=myval2", + "env-test", + ]) + self.assertIn("ZZVAR1='myval2'", str(output)) + finally: + self.run_subprocess_assert_returncode([ + podman_compose_path(), + "-f", + compose_yaml_path(), + "down", + ])