tests: make sure dnsmasq is stopped before starting it again

Avoid conflict on listening port ("Address already in use" error).
Send SIGTERM until all instances of dnsmasq exit.
This commit is contained in:
Marek Marczykowski-Górecki 2020-10-30 21:09:47 +01:00
parent 79d4b7162a
commit 14c636469f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 2 additions and 2 deletions

View File

@ -141,7 +141,7 @@ class VmNetworkingMixin(object):
run_netvm_cmd("iptables -I INPUT -d {} -j ACCEPT --wait".format(
self.test_ip))
# ignore failure
self.run_cmd(self.testnetvm, "pkill dnsmasq")
self.run_cmd(self.testnetvm, "while pkill dnsmasq; do sleep 1; done")
run_netvm_cmd("dnsmasq -a {ip} -A /{name}/{ip} -i test0 -z".format(
ip=self.test_ip, name=self.test_name))
run_netvm_cmd("echo nameserver {} > /etc/resolv.conf".format(

View File

@ -75,7 +75,7 @@ class VmIPv6NetworkingMixin(VmNetworkingMixin):
run_netvm_cmd(
"ip6tables -I INPUT -d {} -j ACCEPT".format(self.test_ip6))
# ignore failure
self.run_cmd(self.testnetvm, "pkill dnsmasq")
self.run_cmd(self.testnetvm, "while pkill dnsmasq; do sleep 1; done")
run_netvm_cmd(
"dnsmasq -a {ip} -A /{name}/{ip} -A /{name}/{ip6} -i test0 -z".
format(ip=self.test_ip, ip6=self.test_ip6, name=self.test_name))