aws / aws/aws-cdk

integ-tests: allow for different props during the stack update workflow

Open
#30,402 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/integ-tests effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Allow `testCase` stacks to use different props on the stack create and update workflows

### Use Case

I have CDK constructs that utilize custom resources. This would allow me to properly test custom resources `onUpdate` operations by changing the properties passed to them

### Proposed Solution

_No response_

### Other Information

I can currently achieve this behavior with the following "workaround". It forces two instances of the stack to use the same stack name to achieve the update functionality

```ts

import * as integ from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { Construct } from "constructs";

const app = new cdk.App();
interface TestStackProps extends cdk.StackProps {
someParameter: string;
}

class TestStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: TestStackProps) {
super(scope, id, props);
// insert construct code here
}
}

const createStack = new TestStack(app, 'test-stack-create', {
someParameter: 'foo',
stackName:'test-stack'
});

const updateStack = new TestStack(app, 'test-stack-update', {
someParameter: 'bar',
stackName:'test-stack'
});

updateStack.addDependency(createStack);

new integ.IntegTest(app, 'integration-test', {
testCases: [createStack, updateStack],
stackUpdateWorkflow: false,
diffAssets: true,
});

```

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.143.1

### Environment details (OS name and version, etc.)

N/A

Contributor guide

Open the contributing guide

Research direction

Start at the TypeScript IntegTest entry point and trace how testCases are processed in the stack update workflow. Check how stackUpdateWorkflow and stack properties are passed to create and update operations; done means a testCase stack can use different props in those two workflows and custom-resource onUpdate behavior can be exercised.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.