Commit 324926ab authored by Martín Ferrari's avatar Martín Ferrari

Fix some errors in the tests

parent d12def45
......@@ -23,16 +23,17 @@ class TestConfigure(unittest.TestCase):
def test_config_run_as_runtime(self):
netns.config.run_as = (self.nobodyid or 65535)
node = netns.Node()
app = a.start_process(["sleep", "1000"])
app = node.start_process(["sleep", "1000"])
pid = app.pid
# FIXME: non-portable *at all*
stat = open("/proc/%d/status" % pid)
while True:
data = stat.readline()
fileds = data.split()
fields = data.split()
if fields[0] != 'Uid:':
continue
uid = fields[1]
break
stat.close()
self.assertEquals(uid, (self.nobodyid or 65535))
......
......@@ -62,7 +62,7 @@ class TestNode(unittest.TestCase):
if chld == 0:
netns.set_cleanup_hooks(on_exit = True, on_signals = [])
create_stuff()
sys.exit()
os._exit(0)
os.waitpid(chld, 0)
self.assertEquals(orig_devs, len(get_devs()))
......@@ -75,7 +75,7 @@ class TestNode(unittest.TestCase):
create_stuff()
while True:
time.sleep(10)
os.kill(chld)
os.kill(chld, signal.SIGTERM)
os.waitpid(chld, 0)
self.assertEquals(orig_devs, len(get_devs()))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment