def test_lxc_start(self): self.addCleanup(self.clean_container, DEFAULT_CONTAINER) _lxc_create(DEFAULT_CONTAINER, config_file=self.config) _lxc_start(DEFAULT_CONTAINER) _lxc_stop(DEFAULT_CONTAINER)
def test_lxc_create(self): self.addCleanup(self.clean_container, DEFAULT_CONTAINER) _lxc_create(DEFAULT_CONTAINER, config_file=self.config) # verify we can find the container output = _lxc_ls() self.assertIn(DEFAULT_CONTAINER, output) # remove and verify the container was removed _lxc_destroy(DEFAULT_CONTAINER) output = _lxc_ls() self.assertNotIn(DEFAULT_CONTAINER, output)
def test_lxc_wait(self): self.addCleanup(self.clean_container, DEFAULT_CONTAINER) _lxc_create(DEFAULT_CONTAINER, config_file=self.config) _lxc_start(DEFAULT_CONTAINER) def waitForState(result): self.assertEqual(result, True) d = _lxc_wait(DEFAULT_CONTAINER, "RUNNING") d.addCallback(waitForState) yield d _lxc_stop(DEFAULT_CONTAINER) yield _lxc_wait(DEFAULT_CONTAINER, "STOPPED") _lxc_destroy(DEFAULT_CONTAINER)