Add zk test to check myid is set in service

Previously we were checking that myid was written to disk in the
expected location. However, it is possible that zk would stop looking in
that location for the myid value. To ensure we actually set the value in
the running service check the logs for the [myid:4] string.

Change-Id: Iee3b126abac13e19dab9ddf4c64ed133d0a98956
This commit is contained in:
Clark Boylan 2023-10-17 09:31:16 -07:00
parent 3a4ce1bd08
commit 5bbbccee18

View File

@ -24,6 +24,12 @@ def test_id_file(host):
myid = host.file('/var/zookeeper/data/myid')
assert myid.content == b'4\n'
def test_zk_myid_is_set(host):
# Test that our wacky hostname regex results in the correct
# myid value in the running service.
cmd = host.run("docker logs zookeeper-compose_zk_1")
assert "[myid:4]" in cmd.stdout
def test_zk_listening(host):
zk = host.socket("tcp://0.0.0.0:2181")
assert zk.is_listening