From 2eecb89567c5a70f85fc26979fd2aa1b3eb6fc3f Mon Sep 17 00:00:00 2001 From: Florian Stadler Date: Wed, 11 Sep 2024 20:17:55 +0200 Subject: [PATCH] Add regression test --- provider/provider_nodejs_test.go | 18 +++++++++++++++++ .../test-programs/regress-4446/Pulumi.yaml | 7 +++++++ provider/test-programs/regress-4446/index.ts | 20 +++++++++++++++++++ .../test-programs/regress-4446/package.json | 11 ++++++++++ .../test-programs/regress-4446/tsconfig.json | 18 +++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 provider/test-programs/regress-4446/Pulumi.yaml create mode 100644 provider/test-programs/regress-4446/index.ts create mode 100644 provider/test-programs/regress-4446/package.json create mode 100644 provider/test-programs/regress-4446/tsconfig.json diff --git a/provider/provider_nodejs_test.go b/provider/provider_nodejs_test.go index b46392b3928..f59cd9a04fd 100644 --- a/provider/provider_nodejs_test.go +++ b/provider/provider_nodejs_test.go @@ -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" ) @@ -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{ diff --git a/provider/test-programs/regress-4446/Pulumi.yaml b/provider/test-programs/regress-4446/Pulumi.yaml new file mode 100644 index 00000000000..159a29ddabb --- /dev/null +++ b/provider/test-programs/regress-4446/Pulumi.yaml @@ -0,0 +1,7 @@ +name: regress-4446 +runtime: nodejs +description: A minimal AWS TypeScript Pulumi program +config: + pulumi:tags: + value: + pulumi:template: aws-typescript diff --git a/provider/test-programs/regress-4446/index.ts b/provider/test-programs/regress-4446/index.ts new file mode 100644 index 00000000000..cf91e48829d --- /dev/null +++ b/provider/test-programs/regress-4446/index.ts @@ -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, + } +); diff --git a/provider/test-programs/regress-4446/package.json b/provider/test-programs/regress-4446/package.json new file mode 100644 index 00000000000..b72eb135278 --- /dev/null +++ b/provider/test-programs/regress-4446/package.json @@ -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" + } +} diff --git a/provider/test-programs/regress-4446/tsconfig.json b/provider/test-programs/regress-4446/tsconfig.json new file mode 100644 index 00000000000..ab65afa6135 --- /dev/null +++ b/provider/test-programs/regress-4446/tsconfig.json @@ -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" + ] +}