shanmugh commented on a change in pull request #37: Staggered (Variable batch) Updates URL: https://github.com/apache/aurora/pull/37#discussion_r220977423
########## File path: src/test/python/apache/aurora/client/api/test_updater_util.py ########## @@ -46,15 +71,94 @@ def test_empty_list(self): assert UpdaterConfig.instances_to_ranges([]) is None, "Result must be None." def test_pulse_interval_secs(self): - config = UpdaterConfig(1, 1, 1, 1, pulse_interval_secs=60) + config = UpdaterConfig( + UpdateConfig(batch_size=1, + watch_secs=1, + max_per_shard_failures=1, + max_total_failures=1, + pulse_interval_secs=60)) assert 60000 == config.to_thrift_update_settings().blockIfNoPulsesAfterMs def test_pulse_interval_unset(self): - config = UpdaterConfig(1, 1, 1, 1) + config = UpdaterConfig( + UpdateConfig(batch_size=1, watch_secs=1, max_per_shard_failures=1, max_total_failures=1)) assert config.to_thrift_update_settings().blockIfNoPulsesAfterMs is None def test_pulse_interval_too_low(self): threshold = UpdaterConfig.MIN_PULSE_INTERVAL_SECONDS with raises(ValueError) as e: - UpdaterConfig(1, 1, 1, 1, pulse_interval_secs=threshold - 1) + UpdaterConfig(UpdateConfig(batch_size=1, + watch_secs=1, + max_per_shard_failures=1, + max_total_failures=1, + pulse_interval_secs=threshold - 1)) assert 'Pulse interval seconds must be at least %s seconds.' % threshold in e.value.message + + def test_to_thrift_update_settings_strategy(self): + + """Test to_thrift produces an expected thrift update settings configuration + from a PyStachio update object. + """ + + update_strategy = Choice([PystachioQueueUpdateStrategy, + PystachioBatchUpdateStrategy, + PystachioVariableBatchUpdateStrategy]) + + config = UpdaterConfig( + UpdateConfig( + update_strategy=update_strategy( + PystachioVariableBatchUpdateStrategy(batch_sizes=[1, 2, 3, 4])))) + + thrift_update_config = config.to_thrift_update_settings() + + update_settings = copy.deepcopy(self.EXPECTED_JOB_UPDATE_SETTINGS) + + update_settings.updateStrategy = JobUpdateStrategy( + batchStrategy=None, + queueStrategy=None, + varBatchStrategy=VariableBatchJobUpdateStrategy(groupSizes=(1, 2, 3, 4))) + + assert thrift_update_config == update_settings + + def test_to_thrift_update_settings_no_strategy_queue(self): + + """Test to_thrift produces an expected thrift update settings configuration + from a PyStachio update object that doesn't include an update strategy. Review comment: nit - `s/PyStachio/Pystachio/` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services