Skip to content

Commit

Permalink
tests: add preview tests for replacements
Browse files Browse the repository at this point in the history
  • Loading branch information
rquitales committed Jun 25, 2024
1 parent f4dde34 commit 620d2b6
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/sdk/java/preview_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package test

import (
"testing"

"github.com/pulumi/providertest/pulumitest"
"github.com/pulumi/providertest/pulumitest/opttest"
)

// TestPreviewReplacements ensures that replacements for immutable fields are correctly previewed.
func TestPreviewReplacements(t *testing.T) {
test := pulumitest.NewPulumiTest(t, "testdata/preview-replacements", opttest.SkipInstall())
t.Logf("into %s", test.Source())
t.Cleanup(func() {
test.Destroy()
})
test.Preview()
test.Up()

// Preview should not fail when there is a replacement due to immutable fields.
test.UpdateSource("testdata/preview-replacements", "step2")
test.Preview()
}
32 changes: 32 additions & 0 deletions tests/sdk/java/testdata/preview-replacements/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: job-unreachable
runtime: yaml
resources:
provider:
type: pulumi:providers:kubernetes
ns:
type: kubernetes:core/v1:Namespace
options:
provider: ${provider}
job:
type: kubernetes:batch/v1:Job
properties:
metadata:
name: test-job-previews
namespace: ${ns.metadata.name}
annotations:
pulumi.com/skipAwait: "true"
spec:
template:
metadata:
name: test-job-unreachable
spec:
containers:
- name: test-job-unreachable-container
image: busybox
command:
- sh
- -c
- exit 0
restartPolicy: Never
options:
provider: ${provider}
32 changes: 32 additions & 0 deletions tests/sdk/java/testdata/preview-replacements/step2/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: job-unreachable
runtime: yaml
resources:
provider:
type: pulumi:providers:kubernetes
ns:
type: kubernetes:core/v1:Namespace
options:
provider: ${provider}
job:
type: kubernetes:batch/v1:Job
properties:
metadata:
name: test-job-previews
namespace: ${ns.metadata.name}
annotations:
pulumi.com/skipAwait: "true"
spec:
template:
metadata:
name: test-job-unreachable
spec:
containers:
- name: test-job-unreachable-container-step2
image: busybox
command:
- sh
- -c
- exit 0
restartPolicy: Never
options:
provider: ${provider}

0 comments on commit 620d2b6

Please sign in to comment.