コード例 #1
0
    def test_compose_with_builder_files(self):
        cb_file = os.path.join(self.tmpdir, 'test-composite-ring.json')
        builders = self.create_sample_ringbuilders(2)
        cb = CompositeRingBuilder(self.save_builders(builders))
        cb.compose().save(self.output_ring)
        self.check_composite_ring(self.output_ring, builders)
        cb.save(cb_file)

        for i, b in enumerate(builders):
            self.add_dev_and_rebalance(b)
        self.save_builders(builders)
        cb = CompositeRingBuilder.load(cb_file)
        cb.compose().save(self.output_ring)
        self.check_composite_ring(self.output_ring, builders)
コード例 #2
0
 def test_abs_paths_persisted(self):
     cwd = os.getcwd()
     try:
         os.chdir(self.tmpdir)
         builders = self.create_sample_ringbuilders(2)
         builder_files = self.save_builders(builders)
         rel_builder_files = [os.path.basename(bf) for bf in builder_files]
         cb = CompositeRingBuilder(rel_builder_files)
         cb.compose().save(self.output_ring)
         self.check_composite_ring(self.output_ring, builders)
         cb_file = os.path.join(self.tmpdir, 'test-composite-ring.json')
         rel_cb_file = os.path.basename(cb_file)
         cb.save(rel_cb_file)
         self.check_composite_meta(rel_cb_file, rel_builder_files)
     finally:
         os.chdir(cwd)