Skip to content

Commit

Permalink
make sure delete the srv namespace after test
Browse files Browse the repository at this point in the history
change __del__ to destroy function

Signed-off-by: Guohan Lu <gulv@microsoft.com>
  • Loading branch information
lguohan committed Oct 22, 2018
1 parent e04bd2d commit 9b49555
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ def __init__(self, ctn_name, pid, i):
ensure_system("nsenter -t %d -n ip link set arp off dev %s" % (pid, self.vifname))
ensure_system("nsenter -t %d -n sysctl -w net.ipv6.conf.%s.disable_ipv6=1" % (pid, self.vifname))

def __del__(self):
def destroy(self):
if self.cleanup:
pids = subprocess.check_output("ip netns pids %s" % (self.nsname), shell=True)
if pids:
for pid in pids.split('\n'):
if len(pid) > 0:
os.system("kill %s" % int(pid))
os.system("ip netns delete %s" % self.nsname)
ensure_system("ip netns delete %s" % self.nsname)

def runcmd(self, cmd):
return os.system("ip netns exec %s %s" % (self.nsname, cmd))
Expand Down Expand Up @@ -211,7 +211,7 @@ def destroy(self):
self.ctn.remove(force=True)
self.ctn_sw.remove(force=True)
for s in self.servers:
del(s)
s.destroy()

def check_ready(self, timeout=30):
'''check if all processes in the dvs is ready'''
Expand Down

0 comments on commit 9b49555

Please sign in to comment.