support/testing: test_syslog_ng: improve commands
There is no need for double grep, so choose a better regexp. Use && instead of ; between commands so the sequence of commands fail faster. Break the last sequence of commands in 2 calls run() so the proper return code can be tested for each. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
parent
a06cd129f8
commit
f3c4a9e1cd
@ -19,18 +19,20 @@ class TestSyslogNg(infra.basetest.BRTest):
|
||||
options=["-initrd", cpio_file])
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "grep syslog-ng /var/log/messages | grep starting"
|
||||
cmd = "grep 'syslog-ng starting' /var/log/messages"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "logger my-message;"
|
||||
cmd += "sleep 1;"
|
||||
cmd = "logger my-message && "
|
||||
cmd += "sleep 1 && "
|
||||
cmd += "grep my-message /var/log/messages"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "syslog-ng-ctl reload;"
|
||||
cmd += "sleep 1;"
|
||||
cmd += "grep syslog-ng /var/log/messages | grep -i warning"
|
||||
cmd = "syslog-ng-ctl reload && "
|
||||
cmd += "sleep 1"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
cmd = "grep -i 'syslog-ng.*warning' /var/log/messages"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
Loading…
Reference in New Issue
Block a user