Beispiel #1
0
    def as_effect(self):
        """Produce a :obj:`Effect` to delete a stack."""
        eff = delete_stack(stack_name=self.stack.name, stack_id=self.stack.id)

        def report_success(result):
            return StepResult.RETRY, [
                ErrorReason.String('Waiting for stack to delete')]

        return eff.on(success=report_success)
Beispiel #2
0
    def as_effect(self):
        """Produce a :obj:`Effect` to delete a stack."""
        eff = delete_stack(stack_name=self.stack.name, stack_id=self.stack.id)

        def report_success(result):
            return StepResult.RETRY, [
                ErrorReason.String('Waiting for stack to delete')]

        return eff.on(success=report_success)
Beispiel #3
0
 def test_ensure_retry(self):
     """Tests that retry will be returned."""
     seq = [
         (delete_stack(stack_id='foo', stack_name='bar').intent,
          lambda _: (StubResponse(204, ''), None)),
         (Log('request-delete-stack', ANY), lambda _: None)
     ]
     foo_stack = stack(id='foo', name='bar')
     delete = DeleteStack(foo_stack)
     reason = ('Waiting for stack to delete')
     result = perform_sequence(seq, delete.as_effect())
     self.assertEqual(result,
                      (StepResult.RETRY, [ErrorReason.String(reason)]))
Beispiel #4
0
    def test_delete_stack(self):
        """Delete stack calls Heat and returns None on a 204."""
        stack_name = 'foostack'
        stack_id = 'foo_id'
        eff = delete_stack(stack_name, stack_id)
        expected_intent = self._delete_stack_intent(stack_name, stack_id)

        seq = [(expected_intent,
                service_request_eqf(stub_pure_response(b'', 204))),
               (log_intent('request-delete-stack', b'',
                           False), lambda _: None)]
        result = perform_sequence(seq, eff)
        self.assertEqual(result, None)
Beispiel #5
0
    def test_delete_stack(self):
        """Delete stack calls Heat and returns None on a 204."""
        stack_name = 'foostack'
        stack_id = 'foo_id'
        eff = delete_stack(stack_name, stack_id)
        expected_intent = self._delete_stack_intent(stack_name, stack_id)

        seq = [
            (expected_intent,
             service_request_eqf(stub_pure_response(b'', 204))),
            (log_intent('request-delete-stack', b'', False), lambda _: None)
        ]
        result = perform_sequence(seq, eff)
        self.assertEqual(result, None)
Beispiel #6
0
 def test_normal_use(self):
     """Tests normal usage."""
     foo_stack = stack(id='foo', name='bar')
     delete = DeleteStack(foo_stack)
     self.assertEqual(delete.as_effect().intent,
                      delete_stack(stack_id='foo', stack_name='bar').intent)