list_alarms.return_value = [mock_alarm, mock_alarm_2]
service = AutoscalingService(self.config)
- asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_in")
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_in")
@mock.patch.object(ScalingAlarmRepository, "list")
@mock.patch.object(ScalingAlarmRepository, "get")
list_alarms.return_value = [mock_alarm, mock_alarm_2]
service = AutoscalingService(self.config)
- asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_not_called()
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_not_called()
@mock.patch.object(ScalingAlarmRepository, "list")
@mock.patch.object(ScalingAlarmRepository, "get")
list_alarms.return_value = [mock_alarm, mock_alarm_2]
service = AutoscalingService(self.config)
- asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_in")
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_in")
@mock.patch.object(ScalingAlarmRepository, "list")
@mock.patch.object(ScalingAlarmRepository, "get")
list_alarms.return_value = [mock_alarm, mock_alarm_2]
service = AutoscalingService(self.config)
- asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_in")
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_in")
@mock.patch.object(ScalingAlarmRepository, "list")
@mock.patch.object(ScalingAlarmRepository, "get")
list_alarms.return_value = [mock_alarm, mock_alarm_2]
service = AutoscalingService(self.config)
- asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_out")
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_out")
@mock.patch.object(ScalingAlarmRepository, "list")
@mock.patch.object(ScalingAlarmRepository, "get")
list_alarms.return_value = [mock_alarm, mock_alarm_2]
service = AutoscalingService(self.config)
- asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_not_called()
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_not_called()
@mock.patch.object(ScalingAlarmRepository, "list")
@mock.patch.object(ScalingAlarmRepository, "get")
service = AutoscalingService(self.config)
asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_out")
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_out")
@mock.patch.object(ScalingAlarmRepository, "list")
@mock.patch.object(ScalingAlarmRepository, "get")
service = AutoscalingService(self.config)
asyncio.run(service.evaluate_policy("test_uuid"))
- scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_out")
+ if self.config.get("autoscale", "enabled") == "True":
+ asyncio.run(service.evaluate_policy("test_uuid"))
+ scale.assert_called_with("test_nsr_id", "test_group", "1", "scale_out")
def _build_mock_alarm(
self,