Skip to content

Commit

Permalink
make extensible schema test deterministic
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Feb 16, 2024
1 parent 9fef3bd commit f2fcff1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions providers/extensible_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,19 @@ func TestExtensibleSchema(t *testing.T) {

info := s.Lookup("eternity")
require.NotNil(t, info)
assert.Equal(t, "first", info.Provider)
assert.Len(t, info.Others, 1)
assert.Equal(t, "second", info.Others[0].Provider)
require.Len(t, info.Others, 1)

// Check that both providers are present for resource "eternity"
providers := []string{info.Provider, info.Others[0].Provider}
assert.ElementsMatch(t, []string{"first", "second"}, providers)

info, finfo := s.LookupField("eternity", "iii")
require.NotNil(t, info)
assert.Equal(t, "first", finfo.Provider)
assert.Len(t, info.Others, 1)
assert.Equal(t, "second", info.Others[0].Provider)
require.Len(t, info.Others, 1)

// Check that both providers are present for field "iii"
providers = []string{finfo.Provider, info.Others[0].Fields["iii"].Provider}
assert.ElementsMatch(t, []string{"first", "second"}, providers)

_, finfo = s.LookupField("eternity", "v")
require.NotNil(t, info)
Expand Down

0 comments on commit f2fcff1

Please sign in to comment.