def testCreateAndDestroy(self): (self._img, self._mnt) = fixture.CreateSheepdogDisk(1024**3) self.assertIsNotNone(self._img) self.assertIsNotNone(self._mnt) self.assertTrue(os.path.isfile(self._img)) self.assertTrue(os.path.isdir(self._mnt)) self.assertEquals(1024**3, os.stat(self._img).st_size) self.assertTrue(fixture.DestroySheepdogDisk(self._img, self._mnt)) (self._img, self._mnt) = (None, None)
def setUpClass(clazz): for i in range(clazz._NR_NODES): t = fixture.CreateSheepdogDisk(1024**3) p = i + 7000 z = i + 1 fixture.StartSheep(t[1], port=p, zone=z) clazz._ports.append(p) clazz._disks.append(t) time.sleep(2)
def setUp(self): self._disks = [] for i in range(3): t = fixture.CreateSheepdogDisk(1024**3) p = i + 7000 z = i + 1 fixture.StartSheep(t[1], port=p, zone=z) self._disks.append(t) time.sleep(2) fixture.ForceFormatCluster(2)
def testStartAndKillNode(self): self.assertFalse(self._SheepExists()) t = fixture.CreateSheepdogDisk(1024**3) self.assertIsNotNone(t) self.assertTrue(fixture.StartSheep(t[1])) self._disks.append(t) time.sleep(2) self.assertTrue(self._SheepExists()) self.assertTrue(fixture.KillLocalNode(7000)) time.sleep(2) self.assertFalse(self._SheepExists())
def testFormatAndShutdownCluster(self): self.assertEquals(1, subprocess.call(["sudo", "pgrep", "sheep"])) for i in range(3): t = fixture.CreateSheepdogDisk(1024**3) p = i + 7000 z = i + 1 self.assertTrue(fixture.StartSheep(t[1], port=p, zone=z)) self._disks.append(t) time.sleep(2) self.assertEquals(0, subprocess.call(["sudo", "pgrep", "sheep"])) self.assertTrue(fixture.ForceFormatCluster(3)) self.assertTrue(fixture.ShutdownCluster()) time.sleep(2) self.assertEquals(1, subprocess.call(["sudo", "pgrep", "sheep"]))
def testFormatAndShutdownCluster(self): self.assertFalse(self._SheepExists()) for i in range(3): t = fixture.CreateSheepdogDisk(1024**3) p = i + 7000 z = i + 1 self.assertTrue(fixture.StartSheep(t[1], port=p, zone=z)) self._disks.append(t) time.sleep(2) self.assertTrue(self._SheepExists()) self.assertTrue(fixture.ForceFormatCluster(3)) self.assertTrue(fixture.ShutdownCluster()) time.sleep(2) self.assertFalse(self._SheepExists())