Implement fixtures for deploying FrostFS components
Exported from a private playground repo @ commit ba8c88d7e11e8e8c17e54ca1317bc2dbf8b52204 Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
parent
1fbd7b7de1
commit
211f9a0abd
13 changed files with 1500 additions and 0 deletions
44
tests/test_component_container_wrapper.py
Normal file
44
tests/test_component_container_wrapper.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
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)
|
Loading…
Add table
Add a link
Reference in a new issue