Skip to content

Commit

Permalink
Upgrade providertest library (#2462)
Browse files Browse the repository at this point in the history
The library had some breaking changes, this should handle that.
  • Loading branch information
VenelinMartinov authored Oct 3, 2024
1 parent 413a578 commit 4058941
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 63 deletions.
4 changes: 2 additions & 2 deletions dynamic/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE=
github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/providertest v0.1.2 h1:9pJS9MeNkMyGwyNeHmvh8QqLgJy39Nk2/ym5u7r13ng=
github.com/pulumi/providertest v0.1.2/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.16.1 h1:orHnDWFbpOERwaBLry9f+6nqPX7x0MsrIkaa5QDGAns=
github.com/pulumi/pulumi-java/pkg v0.16.1/go.mod h1:QH0DihZkWYle9XFc+LJ76m4hUo+fA3RdyaM90pqOaSM=
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.8 h1:mav2tSitA9BPJPLLahKgepHyYsMzwaTm4cvp0dcTMYw=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/mitchellh/reflectwalk v1.0.2
github.com/pkg/errors v0.9.1
github.com/pulumi/inflector v0.1.1
github.com/pulumi/providertest v0.0.14
github.com/pulumi/providertest v0.1.2
github.com/pulumi/pulumi-java/pkg v0.16.1
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.8
github.com/pulumi/pulumi-yaml v1.10.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1902,8 +1902,8 @@ github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE=
github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/providertest v0.1.2 h1:9pJS9MeNkMyGwyNeHmvh8QqLgJy39Nk2/ym5u7r13ng=
github.com/pulumi/providertest v0.1.2/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.16.1 h1:orHnDWFbpOERwaBLry9f+6nqPX7x0MsrIkaa5QDGAns=
github.com/pulumi/pulumi-java/pkg v0.16.1/go.mod h1:QH0DihZkWYle9XFc+LJ76m4hUo+fA3RdyaM90pqOaSM=
github.com/pulumi/pulumi-yaml v1.10.0 h1:djbgMJCxJBmYMr4kOpAXH5iauxGohYjEuTLfxD3NUUI=
Expand Down
4 changes: 2 additions & 2 deletions pf/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1906,8 +1906,8 @@ github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE=
github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/providertest v0.1.2 h1:9pJS9MeNkMyGwyNeHmvh8QqLgJy39Nk2/ym5u7r13ng=
github.com/pulumi/providertest v0.1.2/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.16.1 h1:orHnDWFbpOERwaBLry9f+6nqPX7x0MsrIkaa5QDGAns=
github.com/pulumi/pulumi-java/pkg v0.16.1/go.mod h1:QH0DihZkWYle9XFc+LJ76m4hUo+fA3RdyaM90pqOaSM=
github.com/pulumi/pulumi-yaml v1.10.0 h1:djbgMJCxJBmYMr4kOpAXH5iauxGohYjEuTLfxD3NUUI=
Expand Down
6 changes: 3 additions & 3 deletions pf/tests/dynamic_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,15 @@ func TestCreateResourceWithDynamicAttribute(t *testing.T) {
require.NoError(t, err)
pt := newPulumiTest(t, p, string(bytes))

pt.Preview()
pt.Preview(t)

res := pt.Up()
res := pt.Up(t)

m := res.Outputs["manifest"]

if tc.expectedStateMatches != nil {
// NOTE: ExportStack calls the CLI with --show-secrets.
state := pt.ExportStack()
state := pt.ExportStack(t)
tc.expectedStateMatches(t, state)
}

Expand Down
2 changes: 1 addition & 1 deletion pf/tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-provider-tls/shim v0.0.0-00010101000000-000000000000
github.com/hexops/autogold/v2 v2.2.1
github.com/pulumi/providertest v0.0.15
github.com/pulumi/providertest v0.1.2
github.com/pulumi/pulumi-terraform-bridge/pf v0.0.0
github.com/pulumi/pulumi-terraform-bridge/v3 v3.91.1
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tests v0.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions pf/tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1994,8 +1994,8 @@ github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE=
github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.15 h1:nvpEHVvcAkiq3NguPUutB+si3sjU2PmFqkV8yw9QFhQ=
github.com/pulumi/providertest v0.0.15/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/providertest v0.1.2 h1:9pJS9MeNkMyGwyNeHmvh8QqLgJy39Nk2/ym5u7r13ng=
github.com/pulumi/providertest v0.1.2/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.16.1 h1:orHnDWFbpOERwaBLry9f+6nqPX7x0MsrIkaa5QDGAns=
github.com/pulumi/pulumi-java/pkg v0.16.1/go.mod h1:QH0DihZkWYle9XFc+LJ76m4hUo+fA3RdyaM90pqOaSM=
github.com/pulumi/pulumi-yaml v1.10.0 h1:djbgMJCxJBmYMr4kOpAXH5iauxGohYjEuTLfxD3NUUI=
Expand Down
4 changes: 2 additions & 2 deletions pf/tests/integration/attach_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestAttach(t *testing.T) {
pt := pulumitest.NewPulumiTest(t, source,
opttest.AttachProviderBinary("testbridge", bin),
opttest.SkipInstall())
pt.Preview()
pt.Preview(t)
}

func TestAttachMuxed(t *testing.T) {
Expand All @@ -47,5 +47,5 @@ func TestAttachMuxed(t *testing.T) {
pt := pulumitest.NewPulumiTest(t, source,
opttest.AttachProviderBinary("muxedrandom", bin),
opttest.SkipInstall())
pt.Preview()
pt.Preview(t)
}
2 changes: 1 addition & 1 deletion pf/tests/muxwith_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestNewMuxProvider(t *testing.T) {
p: "FOO"
`)

pt.Up()
pt.Up(t)

require.Equal(t, 1, createCallCount)
}
16 changes: 8 additions & 8 deletions pf/tests/schema_and_program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ resources:
pt, err := pulCheck(t, prov, program)
require.NoError(t, err)

pt.Up()
pt.Up(t)
}

func TestComputedSetNoDiffWhenElementRemoved(t *testing.T) {
Expand Down Expand Up @@ -129,17 +129,17 @@ resources:
pt, err := pulCheck(t, prov, program1)
require.NoError(t, err)

pt.Up()
pt.Up(t)

pulumiYamlPath := filepath.Join(pt.CurrentStack().Workspace().WorkDir(), "Pulumi.yaml")

err = os.WriteFile(pulumiYamlPath, []byte(program2), 0o600)
require.NoError(t, err)

res := pt.Preview(optpreview.Diff())
res := pt.Preview(t, optpreview.Diff())
t.Log(res.StdOut)

for _, entry := range pt.GrpcLog().Entries {
for _, entry := range pt.GrpcLog(t).Entries {
if entry.Method == "/pulumirpc.ResourceProvider/Diff" {
var diff map[string]interface{}
err := json.Unmarshal(entry.Response, &diff)
Expand Down Expand Up @@ -341,12 +341,12 @@ outputs:

pt, err := pulCheck(t, prov, program)
require.NoError(t, err)
upRes := pt.Up()
upRes := pt.Up(t)
t.Log(upRes.StdOut)

require.Equal(t, "Default val", upRes.Outputs["changeReason"].Value)

pt.Preview(optpreview.Diff(), optpreview.ExpectNoChanges())
pt.Preview(t, optpreview.Diff(), optpreview.ExpectNoChanges())
}

type changeReasonPlanModifier struct {
Expand Down Expand Up @@ -403,10 +403,10 @@ outputs:

pt, err := pulCheck(t, prov, program)
require.NoError(t, err)
upRes := pt.Up()
upRes := pt.Up(t)
t.Log(upRes.StdOut)

require.Equal(t, "Default val", upRes.Outputs["changeReason"].Value)

pt.Preview(optpreview.Diff(), optpreview.ExpectNoChanges())
pt.Preview(t, optpreview.Diff(), optpreview.ExpectNoChanges())
}
6 changes: 3 additions & 3 deletions pkg/tests/cross-tests/diff_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ func runDiffCheck(t T, tc diffTestCase) diffResult {
yamlProgram := pd.generateYAML(t, bridgedProvider.P.ResourcesMap(), tc.Config1)
pt := pulcheck.PulCheck(t, bridgedProvider, string(yamlProgram))

pt.Up()
pt.Up(t)

yamlProgram = pd.generateYAML(t, bridgedProvider.P.ResourcesMap(), tc.Config2)
p := filepath.Join(pt.CurrentStack().Workspace().WorkDir(), "Pulumi.yaml")
err := os.WriteFile(p, yamlProgram, 0o600)
require.NoErrorf(t, err, "writing Pulumi.yaml")
x := pt.Up()
x := pt.Up(t)

changes := tfd.parseChangesFromTFPlan(*tfDiffPlan)

diffResponse := pulumiDiffResp{}
for _, entry := range pt.GrpcLog().Entries {
for _, entry := range pt.GrpcLog(t).Entries {
if entry.Method == "/pulumirpc.ResourceProvider/Diff" {
err := json.Unmarshal(entry.Response, &diffResponse)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/cross-tests/input_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func runCreateInputCheck(t T, tc inputTestCase) {

pt := pulcheck.PulCheck(t, bridgedProvider, string(yamlProgram))

pt.Up()
pt.Up(t)

for k := range tc.Resource.Schema {
// TODO: make this recursive
Expand Down
8 changes: 4 additions & 4 deletions pkg/tests/cross-tests/upgrade_state_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func runPulumiUpgrade(t T, res1, res2 *schema.Resource, config1, config2 any, di

yamlProgram := pd.generateYAML(t, prov1.P.ResourcesMap(), config1)
pt := pulcheck.PulCheck(t, prov1, string(yamlProgram))
pt.Up()
stack := pt.ExportStack()
pt.Up(t)
stack := pt.ExportStack(t)
schemaVersion1 := getVersionInState(t, stack)

yamlProgram = pd.generateYAML(t, prov2.P.ResourcesMap(), config2)
Expand All @@ -86,9 +86,9 @@ func runPulumiUpgrade(t T, res1, res2 *schema.Resource, config1, config2 any, di
handle, err := pulcheck.StartPulumiProvider(context.Background(), defProviderShortName, defProviderVer, prov2)
require.NoError(t, err)
pt.CurrentStack().Workspace().SetEnvVar("PULUMI_DEBUG_PROVIDERS", fmt.Sprintf("%s:%d", defProviderShortName, handle.Port))
pt.Up()
pt.Up(t)

stack = pt.ExportStack()
stack = pt.ExportStack(t)
schemaVersion2 := getVersionInState(t, stack)

return schemaVersion1, schemaVersion2
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hexops/autogold/v2 v2.2.1
github.com/hexops/valast v1.4.4
github.com/pulumi/providertest v0.0.15
github.com/pulumi/providertest v0.1.2
github.com/pulumi/pulumi-terraform-bridge/v3 v3.80.0
github.com/pulumi/pulumi/sdk v1.14.1
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions pkg/tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1978,8 +1978,8 @@ github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE=
github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.15 h1:nvpEHVvcAkiq3NguPUutB+si3sjU2PmFqkV8yw9QFhQ=
github.com/pulumi/providertest v0.0.15/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/providertest v0.1.2 h1:9pJS9MeNkMyGwyNeHmvh8QqLgJy39Nk2/ym5u7r13ng=
github.com/pulumi/providertest v0.1.2/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.16.1 h1:orHnDWFbpOERwaBLry9f+6nqPX7x0MsrIkaa5QDGAns=
github.com/pulumi/pulumi-java/pkg v0.16.1/go.mod h1:QH0DihZkWYle9XFc+LJ76m4hUo+fA3RdyaM90pqOaSM=
github.com/pulumi/pulumi-yaml v1.10.0 h1:djbgMJCxJBmYMr4kOpAXH5iauxGohYjEuTLfxD3NUUI=
Expand Down
Loading

0 comments on commit 4058941

Please sign in to comment.