Skip to content

Commit

Permalink
chore(cdk-testing): fix init-go canary (#28365)
Browse files Browse the repository at this point in the history
The init-go canary was broken because the test replaced the aws-cdk go module with a locally build version. However in canaries we want to use the publish versioned instead. This change simply makes the replacement conditional.

Manually tested in CodeBuild.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mrgrain authored Dec 14, 2023
1 parent df66778 commit b8b6baf
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import { integTest, withTemporaryDirectory, ShellHelper, withPackages } from '..

['app', 'sample-app'].forEach(template => {
integTest(`init go ${template}`, withTemporaryDirectory(withPackages(async (context) => {
const isCanary = !!process.env.IS_CANARY;
context.packages.assertJsiiPackagesAvailable();

const shell = ShellHelper.fromContext(context);
await context.packages.makeCliAvailable();

await shell.shell(['cdk', 'init', '-l', 'go', template]);
await shell.shell(['go', 'mod', 'edit', '-replace', 'github.com/aws/aws-cdk-go/awscdk/v2=$CODEBUILD_SRC_DIR/go/awscdk']);

// Canaries will use the generated go.mod as is
// For pipeline tests we replace the source with the locally build one
if (!isCanary) {
await shell.shell(['go', 'mod', 'edit', '-replace', 'github.com/aws/aws-cdk-go/awscdk/v2=$CODEBUILD_SRC_DIR/go/awscdk']);
}

await shell.shell(['go', 'mod', 'tidy']);
await shell.shell(['go', 'test']);
await shell.shell(['cdk', 'synth']);
Expand Down

0 comments on commit b8b6baf

Please sign in to comment.