Skip to content

Commit 9340bcd

Browse files
committed
test: attempt to stabilize syslog hostname filtering
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent ffe9a83 commit 9340bcd

File tree

1 file changed

+22
-3
lines changed
  • test/case/syslog/hostname_filter

1 file changed

+22
-3
lines changed

test/case/syslog/hostname_filter/test.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
77
"""
88

9-
import infamy
109
import time
10+
import infamy
11+
import infamy.iface as iface
12+
from infamy import until
1113

1214
TEST_MESSAGES = [
1315
("router1", "Message from router1"),
@@ -91,6 +93,15 @@
9193
}
9294
})
9395

96+
with test.step("Wait for server interface to be operational"):
97+
until(lambda: iface.get_param(server, server_link, "oper-status") == "up", attempts=20)
98+
99+
with test.step("Verify server IP address is configured"):
100+
until(lambda: iface.address_exist(server, server_link, "10.0.0.1", proto="static"), attempts=20)
101+
102+
with test.step("Verify syslog server is listening on UDP port 514"):
103+
until(lambda: "10.0.0.1:514" in serverssh.runsh("ss -ulnp 2>/dev/null | grep :514 || true").stdout, attempts=20)
104+
94105
with test.step("Configure client to forward logs to server"):
95106
_, client_link = env.ltop.xlate("client", "link")
96107

@@ -131,12 +142,20 @@
131142
}
132143
})
133144

134-
time.sleep(2)
145+
with test.step("Wait for client interface to be operational"):
146+
until(lambda: iface.get_param(client, client_link, "oper-status") == "up", attempts=20)
147+
148+
with test.step("Verify client IP address is configured"):
149+
until(lambda: iface.address_exist(client, client_link, "10.0.0.2", proto="static"), attempts=20)
150+
151+
with test.step("Verify network connectivity between client and server"):
152+
until(lambda: clientssh.runsh("ping -c 1 -W 1 10.0.0.1 >/dev/null 2>&1").returncode == 0, attempts=10)
135153

136154
with test.step("Send log messages with different hostnames"):
137155
for hostname, message in TEST_MESSAGES:
138156
clientssh.runsh(f"logger -t test -p daemon.info -H {hostname} -h 10.0.0.1 '{message}'")
139-
time.sleep(2)
157+
# Give extra time for messages to be received and written to disk on physical hardware
158+
time.sleep(5)
140159

141160
with test.step("Verify router1 log contains only router1 messages"):
142161
rc = serverssh.runsh("cat /var/log/router1 2>/dev/null")

0 commit comments

Comments
 (0)