| 1 |
|
| 2 |
|
| 3 |
import os |
| 4 |
import unittest |
| 5 |
import uuid |
| 6 |
|
| 7 |
from tests.integration.test_utils import RunSubprocessMixin |
| 8 |
from tests.integration.test_utils import podman_compose_path |
| 9 |
from tests.integration.test_utils import test_path |
| 10 |
|
| 11 |
|
| 12 |
def compose_yaml_path() -> str: |
| 13 |
base_path = os.path.join(test_path(), "longlog") |
| 14 |
return os.path.join(base_path, "docker-compose-multibyte.yml") |
| 15 |
|
| 16 |
|
| 17 |
class TestLongLog(unittest.TestCase, RunSubprocessMixin): |
| 18 |
def test_print_until_end_of_multibyte_output(self) -> None: |
| 19 |
|
| 20 |
project_id = f"longlog_{uuid.uuid4().hex[:8]}" |
| 21 |
try: |
| 22 |
out, err = self.run_subprocess_assert_returncode( |
| 23 |
[ |
| 24 |
podman_compose_path(), |
| 25 |
"-p", |
| 26 |
project_id, |
| 27 |
"-f", |
| 28 |
compose_yaml_path(), |
| 29 |
"up", |
| 30 |
], |
| 31 |
0, |
| 32 |
timeout=6.0, |
| 33 |
) |
| 34 |
self.assertEqual(b"", err) |
| 35 |
outstring = out.decode("utf-8") |
| 36 |
self.assertTrue( |
| 37 |
outstring.endswith(" end\n"), f"ending with {outstring[-20:].encode('utf-8')!r}" |
| 38 |
) |
| 39 |
finally: |
| 40 |
self.run_subprocess([ |
| 41 |
podman_compose_path(), |
| 42 |
"-p", |
| 43 |
project_id, |
| 44 |
"-f", |
| 45 |
compose_yaml_path(), |
| 46 |
"down", |
| 47 |
]) |