From a5faae20f01343af1544e5ae383bbb679f79e485 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Fri, 1 Nov 2024 10:44:08 +0100 Subject: [PATCH] Tighten configure cross-tests As part of diagnosing https://github.com/pulumi/pulumi-terraform-bridge/issues/2530, this commit tightens `crosstests.Configure`. My assumption is that we will occasionally see failures in the bridged provider here. --- pkg/internal/tests/cross-tests/configure.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/internal/tests/cross-tests/configure.go b/pkg/internal/tests/cross-tests/configure.go index 84c8a04530..0672e07ec7 100644 --- a/pkg/internal/tests/cross-tests/configure.go +++ b/pkg/internal/tests/cross-tests/configure.go @@ -82,6 +82,9 @@ func Configure( return &schema.Provider{ Schema: provider, ConfigureContextFunc: func(_ context.Context, rd *schema.ResourceData) (any, diag.Diagnostics) { + if rd == nil { + return nil, diag.Errorf("Attempted to configure the provider with nil %T", rd) + } *writeTo = result{rd, true, false} return configureResult, nil @@ -114,7 +117,7 @@ func Configure( require.NoError(t, tfd.Apply(t, plan)) require.True(t, tfResult.wasSet, "terraform configure result was not set") - require.True(t, tfResult.wasSet, "terraform resource result was not set") + require.True(t, tfResult.resourceCreated, "terraform resource result was not set") bridgedProvider := pulcheck.BridgedProvider( t, defProviderShortName, makeProvider(&puResult), @@ -142,7 +145,7 @@ func Configure( pt.Up(t) require.True(t, tfResult.wasSet, "pulumi configure result was not set") - require.True(t, tfResult.wasSet, "pulumi resource result was not set") + require.True(t, tfResult.resourceCreated, "pulumi resource result was not set") assertResourceDataEqual(t, provider, tfResult.data, puResult.data) }