示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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())
示例#5
0
 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"]))
示例#6
0
 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())