def setUp(self): self.config = pmap({'foo': 'bar', 'stack_name': 'to_be_removed'}) self.config_after = {'foo': 'bar'} self.stack = stack(id='foo_id', name='foo_name') self.update_call = update_stack(stack_name=self.stack.name, stack_id=self.stack.id, stack_args=self.config_after)
def as_effect(self): """Produce an :obj:`Effect` to update a stack.""" stack_config = dissoc(thaw(self.stack_config), 'stack_name') eff = update_stack(stack_name=self.stack.name, stack_id=self.stack.id, stack_args=stack_config) def report_success(result): retry_msg = 'Waiting for stack to update' return ((StepResult.RETRY, [ErrorReason.String(retry_msg)]) if self.retry else (StepResult.SUCCESS, [])) return eff.on(success=report_success)
def test_update_stack_with_response_body(self): """Update stack succeeds even if there is content in the response.""" stack_name = 'foostack' stack_id = 'foo_id' stack_args = {'stack': 'data'} eff = update_stack(stack_name, stack_id, stack_args) expected_intent = self._update_stack_intent(stack_name, stack_id, stack_args) seq = [(expected_intent, service_request_eqf(stub_pure_response('xyz', 202))), (log_intent('request-update-stack', 'xyz', False), lambda _: None)] result = perform_sequence(seq, eff) self.assertEqual(result, None)
def test_update_stack(self): """Update stack calls Heat and returns None on a 202.""" stack_name = 'foostack' stack_id = 'foo_id' stack_args = {'stack': 'data'} eff = update_stack(stack_name, stack_id, stack_args) expected_intent = self._update_stack_intent(stack_name, stack_id, stack_args) seq = [(expected_intent, service_request_eqf(stub_pure_response(b'', 202))), (log_intent('request-update-stack', b'', False), lambda _: None)] result = perform_sequence(seq, eff) self.assertEqual(result, None)
def test_update_stack_with_response_body(self): """Update stack succeeds even if there is content in the response.""" stack_name = 'foostack' stack_id = 'foo_id' stack_args = {'stack': 'data'} eff = update_stack(stack_name, stack_id, stack_args) expected_intent = self._update_stack_intent(stack_name, stack_id, stack_args) seq = [ (expected_intent, service_request_eqf(stub_pure_response('xyz', 202))), (log_intent('request-update-stack', 'xyz', False), lambda _: None) ] result = perform_sequence(seq, eff) self.assertEqual(result, None)
def test_update_stack(self): """Update stack calls Heat and returns None on a 202.""" stack_name = 'foostack' stack_id = 'foo_id' stack_args = {'stack': 'data'} eff = update_stack(stack_name, stack_id, stack_args) expected_intent = self._update_stack_intent(stack_name, stack_id, stack_args) seq = [ (expected_intent, service_request_eqf(stub_pure_response(b'', 202))), (log_intent('request-update-stack', b'', False), lambda _: None) ] result = perform_sequence(seq, eff) self.assertEqual(result, None)