Beispiel #1
0
 def test_find_regex_when_no_locks(self):
     with ConsulServiceController().start_service() as service:
         lock_manager = ConsulLockManager(
             consul_client=service.create_consul_client())
         found_locks = lock_manager.find_regex(
             f"{KEY_1}{KEY_DIRECTORY_SEPARATOR}[0-9]+")
         self.assertEqual(0, len(found_locks))
Beispiel #2
0
 def find_regex(service: ConsulDockerisedService):
     consul_client = service.create_consul_client()
     lock_manager = ConsulLockManager(consul_client=consul_client)
     consul_client.kv.put(KEYS_1[1], "unrelated")
     found_locks = lock_manager.find_regex(KEYS_1_REGEX)
     self.assertEqual(2, len(found_locks))
     self.assertIsInstance(found_locks[KEYS_1[0]], ConsulLockInformation)
     self.assertIsNone(found_locks[KEYS_1[1]])
Beispiel #3
0
 def find_regex(service: ConsulDockerisedService):
     consul_client = service.create_consul_client()
     lock_manager = ConsulLockManager(consul_client=consul_client)
     consul_client.kv.put(KEYS_1[1], "unrelated")
     found_locks = lock_manager.find_regex(KEYS_1_REGEX)
     self.assertEqual(2, len(found_locks))
     self.assertIsInstance(found_locks[KEYS_1[0]],
                           ConsulLockInformation)
     self.assertIsNone(found_locks[KEYS_1[1]])
Beispiel #4
0
 def find_regex(service: ConsulDockerisedService):
     lock_manager = ConsulLockManager(consul_client=service.create_consul_client())
     found_locks = lock_manager.find_regex(KEYS_1_REGEX)
     self.assertCountEqual(KEYS_1, [lock.key for lock in found_locks.values()])
Beispiel #5
0
 def test_find_regex_when_no_locks(self):
     with ConsulServiceController().start_service() as service:
         lock_manager = ConsulLockManager(consul_client=service.create_consul_client())
         found_locks = lock_manager.find_regex(f"{KEY_1}{KEY_DIRECTORY_SEPARATOR}[0-9]+")
         self.assertEqual(0, len(found_locks))
Beispiel #6
0
 def find_regex(service: ConsulDockerisedService):
     lock_manager = ConsulLockManager(
         consul_client=service.create_consul_client())
     found_locks = lock_manager.find_regex(KEYS_1_REGEX)
     self.assertCountEqual(KEYS_1,
                           [lock.key for lock in found_locks.values()])