tests/integration: Automate 'env-tests' manual test

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
Monika Kairaityte 2024-07-09 18:50:44 +02:00
parent 585d344d0a
commit 0d24c41afb
2 changed files with 38 additions and 5 deletions

View File

@ -1,5 +0,0 @@
running the following command should give myval2
```
podman_compose run -l monkey -e ZZVAR1=myval2 env-test
```

View File

@ -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",
])