Skip to content

Commit

Permalink
Merge pull request #2585 from pulumi/friel/1655
Browse files Browse the repository at this point in the history
Fix defaultTags to trigger downstream updates
  • Loading branch information
AaronFriel authored Jul 1, 2023
2 parents 93ecd56 + 448bfdb commit b1af0c3
Show file tree
Hide file tree
Showing 14 changed files with 2,090 additions and 369 deletions.
13 changes: 13 additions & 0 deletions examples/default-tags-yaml/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: test-aws-1655
runtime: yaml
description: A minimal Pulumi YAML program
resources:
aws-provider:
type: pulumi:providers:aws
# properties:
# defaultTags: {}
defaultProvider: true
my-bucket:
type: aws:s3:Bucket
outputs:
bucketTags: ${my-bucket.tagsAll}
15 changes: 15 additions & 0 deletions examples/default-tags-yaml/step1/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: test-aws-1655
runtime: yaml
description: A minimal Pulumi YAML program
resources:
aws-provider:
type: pulumi:providers:aws
properties:
defaultTags:
tags:
foo: bar
defaultProvider: true
my-bucket:
type: aws:s3:Bucket
outputs:
bucketTags: ${my-bucket.tagsAll}
15 changes: 15 additions & 0 deletions examples/default-tags-yaml/step2/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: test-aws-1655
runtime: yaml
description: A minimal Pulumi YAML program
resources:
aws-provider:
type: pulumi:providers:aws
properties:
defaultTags:
tags:
foo: quux
defaultProvider: true
my-bucket:
type: aws:s3:Bucket
outputs:
bucketTags: ${my-bucket.tagsAll}
16 changes: 16 additions & 0 deletions examples/default-tags-yaml/step3/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: test-aws-1655
runtime: yaml
description: A minimal Pulumi YAML program
resources:
aws-provider:
type: pulumi:providers:aws
properties:
defaultTags:
tags:
foo: quux
thwomp: pow
defaultProvider: true
my-bucket:
type: aws:s3:Bucket
outputs:
bucketTags: ${my-bucket.tagsAll}
14 changes: 14 additions & 0 deletions examples/default-tags-yaml/step4/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: test-aws-1655
runtime: yaml
description: A minimal Pulumi YAML program
resources:
aws-provider:
type: pulumi:providers:aws
properties:
defaultTags:
tags: {}
defaultProvider: true
my-bucket:
type: aws:s3:Bucket
outputs:
bucketTags: ${my-bucket.tagsAll}
11 changes: 11 additions & 0 deletions examples/default-tags-yaml/step5/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: test-aws-1655
runtime: yaml
description: A minimal Pulumi YAML program
resources:
aws-provider:
type: pulumi:providers:aws
defaultProvider: true
my-bucket:
type: aws:s3:Bucket
outputs:
bucketTags: ${my-bucket.tagsAll}
45 changes: 45 additions & 0 deletions examples/examples_go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ package examples

import (
"path/filepath"
"strconv"
"testing"

"github.com/pulumi/pulumi/pkg/v3/testing/integration"
"github.com/stretchr/testify/assert"
)

func TestAccWebserverGo(t *testing.T) {
Expand All @@ -22,3 +24,46 @@ func TestAccWebserverGo(t *testing.T) {

integration.ProgramTest(t, &test)
}

func TestAccDefaultTagsGo(t *testing.T) {
stepOutputs := []map[string]interface{}{
{},
{
"foo": "bar",
},
{
"foo": "quux",
},
{
"foo": "quux",
"thwomp": "pow",
},
{},
}

editDirs := []integration.EditDir{}
for i, stepOutput := range stepOutputs {
i := i
stepOutput := stepOutput
editDirs = append(editDirs, integration.EditDir{
Dir: filepath.Join(getCwd(t), "default-tags-yaml", "step"+strconv.Itoa(i)),
Additive: true,
ExtraRuntimeValidation: func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) {
stackOutputBucketTags := stackInfo.Outputs["bucketTags"].(map[string]interface{})
assert.Equal(t, stepOutput, stackOutputBucketTags, "Unexpected stack output for step %d", i)
},
})
}

integration.ProgramTest(t, &integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "default-tags-yaml"),

ExtraRuntimeValidation: editDirs[0].ExtraRuntimeValidation,
EditDirs: editDirs[1:],

Config: map[string]string{"aws:region": getEnvRegion(t)},
Quick: true,
DestroyOnCleanup: true,
})

}
4 changes: 3 additions & 1 deletion examples/examples_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ func TestAccWebserver(t *testing.T) {
createEditDir(filepath.Join(getCwd(t), "webserver")),
// Next patch the security group description, necessitating a full replacement of resources.
createEditDir(filepath.Join(getCwd(t), "webserver", "variants", "ssh_description")),
}})
},
RequireService: true,
})

integration.ProgramTest(t, &test)
}
Expand Down
Loading

0 comments on commit b1af0c3

Please sign in to comment.