Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking: Test environment reservation service #31938

Open
Tracked by #31929
mrgrain opened this issue Oct 29, 2024 · 6 comments
Open
Tracked by #31929

Tracking: Test environment reservation service #31938

mrgrain opened this issue Oct 29, 2024 · 6 comments
Assignees
Labels
@aws-cdk/core Related to core CDK functionality cli Issues related to the CDK CLI p1

Comments

@mrgrain
Copy link
Contributor

mrgrain commented Oct 29, 2024

Overview

Our integ tests need to run in an exclusive environment. Currently we are achieving this roughly by two ways:

  • use of sandbox accounts to establish strong boundaries (e.g. canaries vs test pipelines)
  • designation of regions per test to separate different tests within the same sandbox

However this model doesn't scale well. We should keep the Sandbox account boundary because we won't have that many
different sandboxes and setting up accounts as a one-off operation is relatively cheap.

Instead of region designations, we should however have a service that reserves and assigns a an account and region pair to a test case. Some test cases (like cross-account deployments #31934) might reserver multiple pairs. The service can also ensure environments are regularly cleaned up from any accidentally left-over resources.

Requirements

A new service an integration test can request exclusive, pre-configured environments to execute tests in.

  • MUST support exclusive reservations for pairs of account/region from a pool
  • MUST guarantee that test reservations do not starve production reservations (release, canaries...) (for example via the use of different pools)
  • MUST support requesting combinations for cross-account deployment use cased
  • MUST provide the requesting client with required credentials (i.e. role arn) to execute tests, and other execution-specific metadata like unique prefixes, tags to use, existing resource names, etc...
  • MUST be robust against clients dying while holding a reservation (i.e. not hold on to reservations forever)
  • SHOULD support metrics about wait time, test run time, failure rates etc.
  • SHOULD support bootstrapping of envs for a given reservation, e.g. configuring 2 accounts with cross account trust
  • SHOULD support clearing of environments from accidentally left-over resources
  • SHOULD support metrics on accidentally left-over resources and the reservations that caused that
@mrgrain mrgrain added p1 @aws-cdk/core Related to core CDK functionality cli Issues related to the CDK CLI labels Oct 29, 2024
@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 29, 2024

Would also be neat if it could keep statistics about wait time, test run time, failure rates etc.

And if we could request accounts with specific setups, like 2 accts with cross account trust, or manually prepared certificates.

@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 29, 2024

I would like the service to direct the client as much as possible. So it will also hand out Role ARNs to assume, and other parameters that are necessary for the client to work properly (pre-existing resources names, unique prefixes, etc). Ideally clients only need to follow instructions, and operate on as few assumptions of the target environments as possible

@mrgrain
Copy link
Contributor Author

mrgrain commented Oct 30, 2024

And if we could request accounts with specific setups, like 2 accts with cross account trust, or manually prepared certificates.

I would like the service to direct the client as much as possible. So it will also hand out Role ARNs to assume, and other parameters that are necessary for the client to work properly. Ideally clients only need to follow instructions, and operate on as few assumptions of the target environments as possible

Yes, but. We also need to provision for testing of bootstrapping. But I agree that for non-bootrapping test cases, pre-bootstrapped environments would be desirable.

@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 30, 2024

Sure. Maybe then we just ask for 2 accounts and do the --trust bootstrapping as part of the test, that works too. It's probably better!

Requests for the other hand-provisioned crap still stands though 😉 .

The example I always go to is certificates and Hosted Zone IDs. I guess that doesn't apply to CLI tests yet... but (a) we could use the same coordinator for automating construct library tests and (b) I'm sure there will be something manual at some point.

@iliapolo
Copy link
Contributor

iliapolo commented Nov 6, 2024

It would great if this service could also be used in local development. This will make writing and developing complex tests easier, which means we will do more of them.

Perhaps we can create a dedicated pool for local dev usage.

@iliapolo
Copy link
Contributor

iliapolo commented Nov 6, 2024

Maybe then we just ask for 2 accounts and do the --trust bootstrapping as part of the test, that works too. It's probably better!

Yes, I like that better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality cli Issues related to the CDK CLI p1
Projects
None yet
Development

No branches or pull requests

3 participants