Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_entities_update(self):
# Clean up managers
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
config = ActorRuntime.get_actor_config()
with self.assertRaises(ValueError):
config._entities.index(FakeSimpleActor.__name__)
_run(ActorRuntime.register_actor(FakeSimpleActor))
config = ActorRuntime.get_actor_config()
self.assertTrue(config._entities.index(FakeSimpleActor.__name__) >= 0)
def test_entities_update(self):
# Clean up managers
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
config = ActorRuntime.get_actor_config()
with self.assertRaises(ValueError):
config._entities.index(FakeSimpleActor.__name__)
_run(ActorRuntime.register_actor(FakeSimpleActor))
config = ActorRuntime.get_actor_config()
self.assertTrue(config._entities.index(FakeSimpleActor.__name__) >= 0)
def setUp(self):
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
self._serializer = DefaultJSONSerializer()
_run(ActorRuntime.register_actor(FakeSimpleActor))
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
def setUp(self):
ActorRuntime._actor_managers = {}
ActorRuntime.set_actor_config(ActorRuntimeConfig())
self._serializer = DefaultJSONSerializer()
_run(ActorRuntime.register_actor(FakeSimpleActor))
_run(ActorRuntime.register_actor(FakeMultiInterfacesActor))
def test_actor_config(self):
config = ActorRuntime.get_actor_config()
self.assertTrue(config._drain_rebalanced_actors)
self.assertEqual(timedelta(hours=1), config._actor_idle_timeout)
self.assertEqual(timedelta(seconds=30), config._actor_scan_interval)
self.assertEqual(timedelta(minutes=1), config._drain_ongoing_call_timeout)
self.assertEqual(2, len(config._entities))
# apply new config
new_config = ActorRuntimeConfig(
timedelta(hours=3), timedelta(seconds=10), timedelta(minutes=1), False)
ActorRuntime.set_actor_config(new_config)
config = ActorRuntime.get_actor_config()
self.assertFalse(config._drain_rebalanced_actors)
self.assertEqual(timedelta(hours=3), config._actor_idle_timeout)
self.assertEqual(timedelta(seconds=10), config._actor_scan_interval)
self.assertEqual(timedelta(minutes=1), config._drain_ongoing_call_timeout)
self.assertEqual(2, len(config._entities))
def test_actor_config(self):
config = ActorRuntime.get_actor_config()
self.assertTrue(config._drain_rebalanced_actors)
self.assertEqual(timedelta(hours=1), config._actor_idle_timeout)
self.assertEqual(timedelta(seconds=30), config._actor_scan_interval)
self.assertEqual(timedelta(minutes=1), config._drain_ongoing_call_timeout)
self.assertEqual(2, len(config._entities))
# apply new config
new_config = ActorRuntimeConfig(
timedelta(hours=3), timedelta(seconds=10),
timedelta(minutes=1), False)
ActorRuntime.set_actor_config(new_config)
config = ActorRuntime.get_actor_config()
self.assertFalse(config._drain_rebalanced_actors)
self.assertEqual(timedelta(hours=3), config._actor_idle_timeout)
self.assertEqual(timedelta(seconds=10), config._actor_scan_interval)
self.assertEqual(timedelta(minutes=1), config._drain_ongoing_call_timeout)
self.assertEqual(2, len(config._entities))