def test_sync(self): client = clblob.client.Client(self.config) names = [] for count in xrange(20): names.append(client.put(str(count), 'test')['name']) time.sleep(0.2) self.servers['010'].stop() shutil.rmtree(os.path.join('test_blob', '010')) os.makedirs(os.path.join('test_blob', '010')) self.servers['010'].start() client.sync('010') time.sleep(0.2) self.servers['011'].stop() self.servers['012'].stop() for name in names: self.assertEquals('test', client.get(name).read()) self.servers['011'].start() self.servers['012'].start()
def test_sync(self): client = clblob.client.Client(self.config) names = [] for count in xrange(20): names.append(client.put(str(count), "test")["name"]) time.sleep(0.2) self.servers["010"].stop() shutil.rmtree(os.path.join("test_blob", "010")) os.makedirs(os.path.join("test_blob", "010")) self.servers["010"].start() client.sync("010") time.sleep(0.2) self.servers["011"].stop() self.servers["012"].stop() for name in names: self.assertEquals("test", client.get(name).read()) self.servers["011"].start() self.servers["012"].start()
def test_sync_one(self): client = clblob.client.Client(self.config) for count in xrange(20): client.put(str(count), 'test') time.sleep(0.2) names = [info[0] for info in client.list('010', checksum=False)] self.servers['010'].stop() index = sqlite3.connect('test_blob/010/_index') index.execute('DELETE FROM blob WHERE name=?', (names[0],)) index.commit() index.close() self.servers['010'].start() client.sync('010') time.sleep(0.2) found = False for name in client.list('010', checksum=False): if name[0] == names[0]: found = True break self.assertEquals(True, found)
def test_sync_one(self): client = clblob.client.Client(self.config) for count in xrange(20): client.put(str(count), "test") time.sleep(0.2) names = [info[0] for info in client.list("010", checksum=False)] self.servers["010"].stop() index = sqlite3.connect("test_blob/010/_index") index.execute("DELETE FROM blob WHERE name=?", (names[0],)) index.commit() index.close() self.servers["010"].start() client.sync("010") time.sleep(0.2) found = False for name in client.list("010", checksum=False): if name[0] == names[0]: found = True break self.assertEquals(True, found)