Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
flostadler committed Sep 11, 2024
1 parent 0085945 commit 2eecb89
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
18 changes: 18 additions & 0 deletions provider/provider_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/pulumi/providertest/pulumitest/opttest"
"github.com/pulumi/pulumi-aws/provider/v6/pkg/elb"
"github.com/pulumi/pulumi/pkg/v3/testing/integration"
"github.com/pulumi/pulumi/sdk/v3/go/auto/optpreview"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -257,6 +258,23 @@ func TestGameLift(t *testing.T) {
require.Equal(t, "B", result2.Outputs["CustomEventData"].Value)
}

func TestRegress4446(t *testing.T) {
skipIfShort(t)
dir := filepath.Join("test-programs", "regress-4446")
cwd, err := os.Getwd()
require.NoError(t, err)
providerName := "aws"
options := []opttest.Option{
opttest.LocalProviderPath(providerName, filepath.Join(cwd, "..", "bin")),
opttest.YarnLink("@pulumi/aws"),
}
test := pulumitest.NewPulumiTest(t, dir, options...)
upResult := test.Up()
t.Logf("#%v", upResult.Summary)
result := test.Preview(optpreview.ExpectNoChanges())
t.Logf("#%v", result.ChangeSummary)
}

func getJSBaseOptions(t *testing.T) integration.ProgramTestOptions {
envRegion := getEnvRegion(t)
baseJS := integration.ProgramTestOptions{
Expand Down
7 changes: 7 additions & 0 deletions provider/test-programs/regress-4446/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: regress-4446
runtime: nodejs
description: A minimal AWS TypeScript Pulumi program
config:
pulumi:tags:
value:
pulumi:template: aws-typescript
20 changes: 20 additions & 0 deletions provider/test-programs/regress-4446/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const amiId = pulumi.interpolate`/aws/service/eks/optimized-ami/1.30/amazon-linux-2023/x86_64/standard/recommended/image_id`.apply(name =>
aws.ssm.getParameter({ name }, { async: true })
).apply(result => result.value);

const userData = `#!/bin/bash
/etc/eks/bootstrap.sh
`;

const nodeLaunchConfiguration = new aws.ec2.LaunchConfiguration("test",
{
associatePublicIpAddress: true,
imageId: amiId,
instanceType: "t2.medium",
userData: userData,
}
);
11 changes: 11 additions & 0 deletions provider/test-programs/regress-4446/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "regress-4446",
"main": "index.ts",
"devDependencies": {
"@types/node": "^18"
},
"dependencies": {
"@pulumi/pulumi": "^3.0.0",
"@pulumi/aws": "^6.0.0"
}
}
18 changes: 18 additions & 0 deletions provider/test-programs/regress-4446/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.ts"
]
}

0 comments on commit 2eecb89

Please sign in to comment.