Beispiel #1
0
 def test_create_overwrites(self):
     name = self.name
     with helpers.partition(self.controller, name, 1, ['a']):
         with helpers.partition(self.controller, name, 2, ['b']) as p2:
             fetched = self.controller.get(name)
             n, w, h = p2
             self._check_values(fetched, xname=n, xweight=w, xhosts=h)
Beispiel #2
0
 def test_create_overwrites(self):
     name = self.name
     with helpers.partition(self.controller, name, 1, ['a']):
         with helpers.partition(self.controller, name, 2, ['b']) as p2:
             fetched = self.controller.get(name)
             n, w, h = p2
             self._check_values(fetched, xname=n, xweight=w, xhosts=h)
Beispiel #3
0
    def test_partition_updates(self):
        with helpers.partition(self.controller, 'a', 10, ['a']):
            self.controller.update('a', weight=11)
            self.assertEqual(self.controller.get('a')['weight'], 11)

            self.controller.update('a', hosts=['b'])
            self.assertEqual(self.controller.get('a')['hosts'], ['b'])

            # Multi-update
            self.controller.update('a', hosts=['c'], weight=12)
            self.assertEqual(self.controller.get('a')['weight'], 12)
            self.assertEqual(self.controller.get('a')['hosts'], ['c'])
Beispiel #4
0
    def test_partition_updates(self):
        with helpers.partition(self.controller, 'a', 10, ['a']):
            self.controller.update('a', weight=11)
            self.assertEqual(self.controller.get('a')['weight'], 11)

            self.controller.update('a', hosts=['b'])
            self.assertEqual(self.controller.get('a')['hosts'], ['b'])

            # Multi-update
            self.controller.update('a', hosts=['c'], weight=12)
            self.assertEqual(self.controller.get('a')['weight'], 12)
            self.assertEqual(self.controller.get('a')['hosts'], ['c'])
Beispiel #5
0
    def test_partition_life_cycle(self):
        # check listing is initially empty
        for p in self.controller.list():
            self.fail('There should be no partitions at this time')

        # create a listing, check its length
        with helpers.partitions(self.controller, 10):
            ps = list(self.controller.list())
            self.assertEqual(len(ps), 10)

        # create, check existence, delete
        with helpers.partition(self.controller, self.name, 1, ['a']):
            self.assertTrue(self.controller.exists(self.name))

        # verify it no longer exists
        self.assertFalse(self.controller.exists(self.name))

        # verify it isn't listable
        self.assertEqual(len(list(self.controller.list())), 0)
Beispiel #6
0
    def test_partition_life_cycle(self):
        # check listing is initially empty
        for p in self.controller.list():
            self.fail('There should be no partitions at this time')

        # create a listing, check its length
        with helpers.partitions(self.controller, 10):
            ps = list(self.controller.list())
            self.assertEqual(len(ps), 10)

        # create, check existence, delete
        with helpers.partition(self.controller, self.name, 1, ['a']):
            self.assertTrue(self.controller.exists(self.name))

        # verify it no longer exists
        self.assertFalse(self.controller.exists(self.name))

        # verify it isn't listable
        self.assertEqual(len(list(self.controller.list())), 0)
Beispiel #7
0
 def test_exists(self):
     name = self.name
     with helpers.partition(self.controller, name, 10, ['a']):
         self.assertTrue(self.controller.exists(name))
Beispiel #8
0
 def test_get(self):
     name = self.name
     with helpers.partition(self.controller, name, 10, ['a']) as expect:
         p = self.controller.get(name)
         n, w, h = expect
         self._check_values(p, xname=n, xweight=w, xhosts=h)
Beispiel #9
0
 def test_exists(self):
     name = self.name
     with helpers.partition(self.controller, name, 10, ['a']):
         self.assertTrue(self.controller.exists(name))
Beispiel #10
0
 def test_get(self):
     name = self.name
     with helpers.partition(self.controller, name, 10, ['a']) as expect:
         p = self.controller.get(name)
         n, w, h = expect
         self._check_values(p, xname=n, xweight=w, xhosts=h)