Test

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

Bases: object

Specify a test that the canary should run.

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_6_2,
    environment_variables={
        "stage": "prod"
    }
)

Attributes

code

The code that the canary should run.

handler

The handler of the canary.

Static Methods

classmethod custom(*, code, handler)

Specify a custom test with your own code.

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

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

Return type:

Test

Returns:

Test associated with the specified Code object