Test

class aws_cdk.aws_synthetics.Test(*args: Any, **kwargs)

Bases: object

(experimental) Specify a test that the canary should run.

Stability:

experimental

ExampleMetadata:

infused

Example:

canary = synthetics.Canary(self, "MyCanary",
    schedule=synthetics.Schedule.rate(Duration.minutes(5)),
    test=synthetics.Test.custom(
        code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
        handler="index.handler"
    ),
    runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_1,
    environment_variables={
        "stage": "prod"
    }
)

Attributes

code

(experimental) The code that the canary should run.

Stability:

experimental

handler

(experimental) The handler of the canary.

Stability:

experimental

Static Methods

classmethod custom(*, code, handler)

(experimental) Specify a custom test with your own code.

Parameters:
  • code (Code) – (experimental) The code of the canary script.

  • handler (str) – (experimental) The handler for the code. Must end with .handler.

Return type:

Test

Returns:

Test associated with the specified Code object

Stability:

experimental