Ejemplo n.º 1
0
    def test_create_change_set_stack_did_not_change(self) -> None:
        """Test create change set stack did not change."""
        self.stubber.add_response(
            "create_change_set", {"Id": "CHANGESETID", "StackId": "STACKID"}
        )

        self.stubber.add_response(
            "describe_change_set",
            generate_change_set_response(
                "FAILED", status_reason="Stack didn't contain changes."
            ),
        )

        self.stubber.add_response(
            "delete_change_set", {}, expected_params={"ChangeSetName": "CHANGESETID"}
        )

        with self.stubber:
            with self.assertRaises(exceptions.StackDidNotChange):
                create_change_set(
                    cfn_client=self.cfn,
                    fqn="my-fake-stack",
                    template=Template(url="http://fake.template.url.com/"),
                    parameters=[],
                    tags=[],
                )
Ejemplo n.º 2
0
    def test_create_change_set_unhandled_failed_status(self):
        """Test create change set unhandled failed status."""
        self.stubber.add_response("create_change_set", {
            'Id': 'CHANGESETID',
            'StackId': 'STACKID'
        })

        self.stubber.add_response(
            "describe_change_set",
            generate_change_set_response(
                "FAILED", status_reason="Some random bad thing."))

        with self.stubber:
            with self.assertRaises(exceptions.UnhandledChangeSetStatus):
                create_change_set(
                    cfn_client=self.cfn,
                    fqn="my-fake-stack",
                    template=Template(url="http://fake.template.url.com/"),
                    parameters=[],
                    tags=[])
Ejemplo n.º 3
0
    def test_create_change_set_bad_execution_status(self):
        """Test create change set bad execution status."""
        self.stubber.add_response("create_change_set", {
            'Id': 'CHANGESETID',
            'StackId': 'STACKID'
        })

        self.stubber.add_response(
            "describe_change_set",
            generate_change_set_response(
                status="CREATE_COMPLETE",
                execution_status="UNAVAILABLE",
            ))

        with self.stubber:
            with self.assertRaises(exceptions.UnableToExecuteChangeSet):
                create_change_set(
                    cfn_client=self.cfn,
                    fqn="my-fake-stack",
                    template=Template(url="http://fake.template.url.com/"),
                    parameters=[],
                    tags=[])