Skip to content

Commit

Permalink
Add node-based upgrade tests
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Nov 10, 2023
1 parent 7f6e889 commit beb227c
Show file tree
Hide file tree
Showing 14 changed files with 4,222 additions and 0 deletions.
61 changes: 61 additions & 0 deletions provider/provider_nodejs_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2016-2023, Pulumi Corporation. All rights reserved.
//
// Experimental provider upgrade tests.
//
// The objective of these tests is to make sure the provider release candidate will not generate any
// Update or Replace plans for Pulumi stacks deployed on a previous baseline version of the
// provider.
//
// Note on build flags above --^ these tests currently uses YAML only but our build workflow matrix
// does not run YAML-only test a the moment, and it splits tests by language build tag; for this
// reason the file is marked as another language so that the test runs only once.

//go:build !go && !yaml && !python && !dotnet && !java
// +build !go,!yaml,!python,!dotnet,!java

package provider

import (
"path/filepath"
"testing"

"github.com/pulumi/providertest"
"os"
)

func TestLambdaLayerNew(t *testing.T) {
nodeTest(t, filepath.Join("..", "examples", "lambda-layer-new"))
}

func TestCloudWatch(t *testing.T) {
nodeTest(t, filepath.Join("..", "examples", "cloudwatch"))
}

func TestLogGroup(t *testing.T) {
nodeTest(t, filepath.Join("..", "examples", "logGroup"))
}

func TestQueue(t *testing.T) {
nodeTest(t, filepath.Join("..", "examples", "queue"))
}

func TestRoute53(t *testing.T) {
nodeTest(t, filepath.Join("..", "examples", "route53"))
}

func nodeTest(t *testing.T, dir string, opts ...providertest.Option) {
envRegion := getEnvRegion(t)
opts = append(opts,
providertest.WithConfig("aws:region", "INVALID_REGION"),
providertest.WithConfig("aws:envRegion", envRegion),
)
test(t, dir, opts...)
}

func getEnvRegion(t *testing.T) string {
envRegion := os.Getenv("AWS_REGION")
if envRegion == "" {
envRegion = "us-west-2"
}
return envRegion
}
4 changes: 4 additions & 0 deletions provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ func test(t *testing.T, dir string, opts ...providertest.Option) {
ptest := providertest.NewProviderTest(dir, opts...)
ptest.Run(t)
}

func TestUpgradeCoverage(t *testing.T) {
providertest.ReportUpgradeCoverage(t)
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"version": 3,
"deployment": {
"manifest": {
"time": "2023-11-10T17:59:05.075652-05:00",
"magic": "7a709c148c841bd111f454593cb3e2e763c9bdd1e384d02234b29bc070e10e78",
"version": "v3.92.0"
},
"secrets_providers": {
"type": "passphrase",
"state": {
"salt": "v1:7qfZ4pQNjbM=:v1:rFQ+HjkTS4MXSgZG:JYQw7c6F5ugfqGsRniKfnaHZTy9ttQ=="
}
},
"resources": [
{
"urn": "urn:pulumi:p-it-antons-mac-lambda-lay-8cf36131::lambda-layer-new::pulumi:pulumi:Stack::lambda-layer-new-p-it-antons-mac-lambda-lay-8cf36131",
"custom": false,
"type": "pulumi:pulumi:Stack",
"outputs": {
"layerArn": "arn:aws:lambda:us-west-2:616138583583:layer:lambda_layer_name:11",
"layerSize": 236
},
"created": "2023-11-10T22:58:57.007568Z",
"modified": "2023-11-10T22:58:57.007568Z",
"sourcePosition": "project:///node_modules/@pulumi/runtime/stack.ts#36,23"
},
{
"urn": "urn:pulumi:p-it-antons-mac-lambda-lay-8cf36131::lambda-layer-new::pulumi:providers:aws::prov",
"custom": true,
"id": "54d0f22d-0538-4b5a-8ede-41e1befd4752",
"type": "pulumi:providers:aws",
"inputs": {
"region": "us-west-2",
"skipCredentialsValidation": "false",
"skipMetadataApiCheck": "true",
"skipRegionValidation": "true",
"version": "5.42.0"
},
"outputs": {
"region": "us-west-2",
"skipCredentialsValidation": "false",
"skipMetadataApiCheck": "true",
"skipRegionValidation": "true",
"version": "5.42.0"
},
"parent": "urn:pulumi:p-it-antons-mac-lambda-lay-8cf36131::lambda-layer-new::pulumi:pulumi:Stack::lambda-layer-new-p-it-antons-mac-lambda-lay-8cf36131",
"propertyDependencies": {
"region": null,
"skipCredentialsValidation": null,
"skipMetadataApiCheck": null,
"skipRegionValidation": null
},
"created": "2023-11-10T22:58:58.565395Z",
"modified": "2023-11-10T22:58:58.565395Z",
"sourcePosition": "project:///node_modules/@pulumi/provider.ts#128,9"
},
{
"urn": "urn:pulumi:p-it-antons-mac-lambda-lay-8cf36131::lambda-layer-new::aws:lambda/layerVersion:LayerVersion::my-layer-version",
"custom": true,
"id": "arn:aws:lambda:us-west-2:616138583583:layer:lambda_layer_name:11",
"type": "aws:lambda/layerVersion:LayerVersion",
"inputs": {
"__defaults": [
"skipDestroy"
],
"code": {
"4dabf18193072939515e22adb298388d": "0def7320c3a5731c473e5ecbe6d01bc7",
"assets": {
"index.js": {
"4dabf18193072939515e22adb298388d": "c44067f5952c0a294b673a41bacd8c17",
"hash": "fd60d6666d78aeb7725928f9b92129b682f188a66573523e6795928d0a97cd77",
"text": "exports.handler = (e, c, cb) => cb(null, {statusCode: 200, body: 'Hello, world!'});"
}
},
"hash": "b898ebe846ff6543102dd399b89309fad766b5a1620bdb18c08b234b0b9bbd8a"
},
"compatibleRuntimes": [
"nodejs10.x",
"nodejs12.x"
],
"layerName": "lambda_layer_name",
"skipDestroy": false
},
"outputs": {
"arn": "arn:aws:lambda:us-west-2:616138583583:layer:lambda_layer_name:11",
"code": {
"4dabf18193072939515e22adb298388d": "0def7320c3a5731c473e5ecbe6d01bc7",
"assets": {
"index.js": {
"4dabf18193072939515e22adb298388d": "c44067f5952c0a294b673a41bacd8c17",
"hash": "fd60d6666d78aeb7725928f9b92129b682f188a66573523e6795928d0a97cd77",
"text": "exports.handler = (e, c, cb) => cb(null, {statusCode: 200, body: 'Hello, world!'});"
}
},
"hash": "b898ebe846ff6543102dd399b89309fad766b5a1620bdb18c08b234b0b9bbd8a"
},
"compatibleArchitectures": [],
"compatibleRuntimes": [
"nodejs10.x",
"nodejs12.x"
],
"createdDate": "2023-11-10T22:59:04.850+0000",
"description": "",
"id": "arn:aws:lambda:us-west-2:616138583583:layer:lambda_layer_name:11",
"layerArn": "arn:aws:lambda:us-west-2:616138583583:layer:lambda_layer_name",
"layerName": "lambda_layer_name",
"licenseInfo": "",
"signingJobArn": "",
"signingProfileVersionArn": "",
"skipDestroy": false,
"sourceCodeHash": "yIGkchJOBl4WngdvqxG31xQS90gp7Zfmtqqp4T24JM0=",
"sourceCodeSize": 236,
"version": "11"
},
"parent": "urn:pulumi:p-it-antons-mac-lambda-lay-8cf36131::lambda-layer-new::pulumi:pulumi:Stack::lambda-layer-new-p-it-antons-mac-lambda-lay-8cf36131",
"provider": "urn:pulumi:p-it-antons-mac-lambda-lay-8cf36131::lambda-layer-new::pulumi:providers:aws::prov::54d0f22d-0538-4b5a-8ede-41e1befd4752",
"propertyDependencies": {
"code": null,
"compatibleRuntimes": null,
"layerName": null
},
"created": "2023-11-10T22:59:05.063925Z",
"modified": "2023-11-10T22:59:05.063925Z",
"sourcePosition": "project:///index.ts#10,13"
}
]
}
}
Loading

0 comments on commit beb227c

Please sign in to comment.