Exported from a private playground repo @ commit ba8c88d7e11e8e8c17e54ca1317bc2dbf8b52204 Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import pytest
|
|
|
|
from frostfs_testlib.component_tests.container import ContainerizedService
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"image",
|
|
[
|
|
"busybox:musl",
|
|
"golang:1.24",
|
|
"python:3.12",
|
|
],
|
|
)
|
|
def test_containerized_wrapper(image, neogo_deployment):
|
|
demo = ContainerizedService(
|
|
image=image,
|
|
command='tick=0; while true; do tick=$((tick+1)); echo "tick=$tick"; sleep 0.1; done',
|
|
)
|
|
demo.add_file(neogo_deployment.template, "/neogo/config.yml")
|
|
demo.start()
|
|
result = demo.exec("cat /neogo/config.yml")
|
|
assert result.exit_code == 0
|
|
assert "StandbyCommittee" in str(result.output)
|
|
print(f"Checking logs for {demo.name}")
|
|
seen = []
|
|
for line in demo.logs(timeout=20):
|
|
if "tick=3" in line:
|
|
break
|
|
seen.append(line)
|
|
if len(seen) > 15:
|
|
assert False, "expected output did not appear in container logs"
|
|
demo.destroy()
|
|
|
|
|
|
@pytest.mark.timeout(15)
|
|
def test_wait_for_logs():
|
|
demo = ContainerizedService(
|
|
image="busybox:musl",
|
|
command='tick=0; while true; do tick=$((tick+1)); echo "tick=$tick"; sleep 0.1; done',
|
|
)
|
|
demo.start()
|
|
demo.wait("tick=1", timeout=5)
|
|
with pytest.raises(TimeoutError):
|
|
demo.wait("impossible line", timeout=5)
|