def test_nothing_to_no_change_update(self): property_provider = TestPropertyProvider({}) exit_handler = TestExitHandler() config_manager = ConfigManager(property_provider) self.assertEqual(None, config_manager.get_str(CPU_ALLOCATOR)) watcher = RestartPropertyWatcher(config_manager, exit_handler, [CPU_ALLOCATOR]) watcher.detect_changes() self.assertEqual(None, exit_handler.last_code)
def test_none_to_something_update(self): property_provider = TestPropertyProvider({}) exit_handler = TestExitHandler() config_manager = ConfigManager(property_provider) self.assertEqual(None, config_manager.get_str(CPU_ALLOCATOR)) watcher = RestartPropertyWatcher(config_manager, exit_handler, [CPU_ALLOCATOR]) property_provider.map[CPU_ALLOCATOR] = GREEDY watcher.detect_changes() self.assertEqual(GENERIC_PROPERTY_CHANGE_EXIT, exit_handler.last_code)
def test_noop_to_ip_update(self): property_provider = TestPropertyProvider({CPU_ALLOCATOR: NOOP}) exit_handler = TestExitHandler() config_manager = ConfigManager(property_provider) watcher = RestartPropertyWatcher(config_manager, exit_handler, [CPU_ALLOCATOR]) # No change yet watcher.detect_changes() self.assertEqual(None, exit_handler.last_code) # titus-isolate should exit when the allocator changes property_provider.map[CPU_ALLOCATOR] = IP watcher.detect_changes() self.assertEqual(ALLOCATOR_CONFIG_CHANGE_EXIT, exit_handler.last_code)