Skip to content

Commit

Permalink
Add an e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailshilkov committed Jan 9, 2025
1 parent d6afd09 commit 7772878
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/sdk/java/autonaming_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"
"github.com/stretchr/testify/assert"
)

// TestAutonaming ensures that custom resource autonaming configuration works as expected.
func TestAutonaming(t *testing.T) {
test := pulumitest.NewPulumiTest(t, "testdata/autonaming", opttest.SkipInstall(), opttest.Env("PULUMI_EXPERIMENTAL", "1"))
t.Logf("into %s", test.Source())
t.Cleanup(func() {
test.Destroy(t)
})
test.Preview(t)
up := test.Up(t)
nsname, ok := up.Outputs["nsname"].Value.(string)
assert.True(t, ok)
assert.Contains(t, nsname, "autonaming-ns-") // project + name + random suffix
}
11 changes: 11 additions & 0 deletions tests/sdk/java/testdata/autonaming/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: autonaming
runtime: yaml
config:
pulumi:autonaming:
value:
pattern: ${project}-${name}-${alphanum(6)}
outputs:
nsname: ${ns.metadata.name}
resources:
ns:
type: kubernetes:core/v1:Namespace

0 comments on commit 7772878

Please sign in to comment.