Skip to content

Commit

Permalink
chore(cdk-testing): fix init-go canary
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.
  • Loading branch information
mrgrain committed Dec 14, 2023
1 parent 93681e0 commit 29da0db
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 29da0db

Please sign in to comment.