Skip to content

Commit

Permalink
use accurate bridge preview flag for all diff tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VenelinMartinov committed Nov 25, 2024
1 parent e0e1b42 commit fcb17da
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions pkg/pf/tests/genrandom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestGenRandom(t *testing.T) {

t.Run(trace, func(t *testing.T) {
p := testprovider.RandomProvider()
p.EnableAccurateBridgePreview = true
server, err := newProviderServer(t, p)
require.NoError(t, err)
testutils.ReplayFile(t, server, trace)
Expand Down
4 changes: 3 additions & 1 deletion pkg/pf/tests/genupdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ func TestGenUpdates(t *testing.T) {
t.Parallel()
trace := "testdata/updateprogram.json"

server, err := newProviderServer(t, testprovider.SyntheticTestBridgeProvider())
info := testprovider.SyntheticTestBridgeProvider()
info.EnableAccurateBridgePreview = true
server, err := newProviderServer(t, info)
require.NoError(t, err)
testutils.ReplayFile(t, server, trace)
}
2 changes: 1 addition & 1 deletion pkg/pf/tests/internal/cross-tests/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func Diff(t T, res pb.Resource, tfConfig1, tfConfig2 map[string]cty.Value, optio
require.NoError(t, err)
t.Logf("Pulumi.yaml:\n%s", string(bytes))

pt, err := pulcheck.PulCheck(t, bridgedProvider(prov), string(bytes))
pt, err := pulcheck.PulCheck(t, bridgedProvider(prov, bridgedProviderOpts{enableAccurateBridgePreview: true}), string(bytes))
require.NoError(t, err)
pt.Up(t)

Expand Down
15 changes: 10 additions & 5 deletions pkg/pf/tests/internal/cross-tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,19 @@ func skipUnlessLinux(t T) {
}
}

func bridgedProvider(prov *providerbuilder.Provider) info.Provider {
type bridgedProviderOpts struct {
enableAccurateBridgePreview bool
}

func bridgedProvider(prov *providerbuilder.Provider, opts bridgedProviderOpts) info.Provider {
shimProvider := tfbridge.ShimProvider(prov)

provider := tfbridge0.ProviderInfo{
P: shimProvider,
Name: prov.TypeName,
Version: prov.Version,
MetadataInfo: &tfbridge0.MetadataInfo{},
P: shimProvider,
Name: prov.TypeName,
Version: prov.Version,
MetadataInfo: &tfbridge0.MetadataInfo{},
EnableAccurateBridgePreview: opts.enableAccurateBridgePreview,
}

provider.MustComputeTokens(tokens.SingleModule(prov.TypeName, "index", tokens.MakeStandard(prov.TypeName)))
Expand Down
8 changes: 6 additions & 2 deletions pkg/pf/tests/provider_diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ func TestEmptyTestresDiff(t *testing.T) {
// Test removing an optional input.
func TestOptionRemovalTestresDiff(t *testing.T) {
t.Parallel()
server, err := newProviderServer(t, testprovider.SyntheticTestBridgeProvider())
info := testprovider.SyntheticTestBridgeProvider()
info.EnableAccurateBridgePreview = true
server, err := newProviderServer(t, info)
require.NoError(t, err)
testCase := `
{
Expand Down Expand Up @@ -270,7 +272,9 @@ func TestSetNestedObjectAdded(t *testing.T) {

func TestSetNestedObjectAddedOtherDiff(t *testing.T) {
t.Parallel()
server, err := newProviderServer(t, testprovider.SyntheticTestBridgeProvider())
info := testprovider.SyntheticTestBridgeProvider()
info.EnableAccurateBridgePreview = true
server, err := newProviderServer(t, info)
require.NoError(t, err)
testCase := `
{
Expand Down

0 comments on commit fcb17da

Please sign in to comment.