示例#1
0
    def confirm_deployment_spec(self):
        return create_spec(deployment_check.ConfirmDeployment
            , deploys_s3_path = optional_spec(listof(stack_specs.s3_address()))
            , zero_instances_is_ok = defaulted(boolean(), False)
            , auto_scaling_group_name = optional_spec(formatted(string_spec(), formatter=MergedOptionStringFormatter))

            , url_checker = optional_spec(self.url_checker_spec)

            , sns_confirmation = optional_spec(create_spec(deployment_check.SNSConfirmation
                , validators.deprecated_key("auto_scaling_group_id", "Use ``confirm_deployment.auto_scaling_group_name``")
                , validators.deprecated_key("env", "Use ``stack.<stack>.env`` instead``")

                , timeout = defaulted(integer_spec(), 300)
                , version_message = required(formatted(string_spec(), formatter=MergedOptionStringFormatter))
                , deployment_queue = required(formatted(string_spec(), formatter=MergedOptionStringFormatter))
                ))
            )
示例#2
0
    def confirm_deployment_spec(self):
        return create_spec(deployment_check.ConfirmDeployment
            , deploys_s3_path = optional_spec(listof(stack_specs.s3_address()))
            , zero_instances_is_ok = defaulted(boolean(), False)
            , auto_scaling_group_name = optional_spec(formatted(string_spec(), formatter=MergedOptionStringFormatter))

            , url_checker = optional_spec(self.url_checker_spec)

            , sns_confirmation = optional_spec(create_spec(deployment_check.SNSConfirmation
                , validators.deprecated_key("auto_scaling_group_id", "Use ``confirm_deployment.auto_scaling_group_name``")
                , validators.deprecated_key("env", "Use ``stack.<stack>.env`` instead``")

                , timeout = defaulted(integer_spec(), 300)
                , version_message = required(formatted(string_spec(), formatter=MergedOptionStringFormatter))
                , deployment_queue = required(formatted(string_spec(), formatter=MergedOptionStringFormatter))
                ))
            )
示例#3
0
        one = self.unique_val()
        meta = Meta(MergedOptions.using({"one": one}), [])
        command = "blah {one} meh"
        expected = ["blah {0} meh".format(one)]
        self.assertEqual(specs.artifact_command_spec().normalise(meta, {"command": command}).command, expected)

    it "makes modify as a dictionary":
        res = specs.artifact_command_spec().normalise(self.meta, {"modify": {"somewhere": {"append": "stuff"}}})
        self.assertEqual(res.modify, {"somewhere": {"append": ["stuff"]}})

describe BespinCase, "s3_address":
    before_each:
        self.meta = mock.Mock(name="meta", spec=Meta)

    it "returns an S3 Address":
        res = specs.s3_address().normalise(self.meta, "s3://blah/and/stuff")
        self.assertEqual(res, objs.S3Address("blah", "/and/stuff", 600))

        res = specs.s3_address().normalise(self.meta, "s3://blah")
        self.assertEqual(res, objs.S3Address("blah", "/", 600))

        res = specs.s3_address().normalise(self.meta, "s3://blah/")
        self.assertEqual(res, objs.S3Address("blah", "/", 600))

    it "can have a timeout specified as well":
        res = specs.s3_address().normalise(self.meta, ["s3://blah/and/stuff", 700])
        self.assertEqual(res, objs.S3Address("blah", "/and/stuff", 700))

    it "complains if the address is invalid":
        for val in ("http://somewhere", "amds"):
            with self.fuzzyAssertRaisesError(BadSpecValue, "Not a valid s3 address", got=val, meta=self.meta):