diff --git a/pkg/file/types.go b/pkg/file/types.go index 0c78789..d7dd6d4 100644 --- a/pkg/file/types.go +++ b/pkg/file/types.go @@ -949,7 +949,7 @@ func (f *FCustomEntity) UnmarshalJSON(b []byte) error { } return copyToFCustomEntity(entity, f) default: - return fmt.Errorf("unknown entity type: %s", *f.Type) + return fmt.Errorf("unknown entity type: %s", temp["type"]) } } diff --git a/tests/integration/sync_test.go b/tests/integration/sync_test.go index a159e69..d5c6938 100644 --- a/tests/integration/sync_test.go +++ b/tests/integration/sync_test.go @@ -7593,7 +7593,7 @@ func Test_Sync_DegraphqlRoutes(t *testing.T) { currentState, err := fetchCurrentState(ctx, client, dumpConfig) require.NoError(t, err) - targetState := stateFromFile(ctx, t, "testdata/sync/036-degraphql-routes/kong.yaml", client, dumpConfig) + targetState := stateFromFile(ctx, t, "testdata/sync/037-degraphql-routes/kong.yaml", client, dumpConfig) syncer, err := deckDiff.NewSyncer(deckDiff.SyncerOpts{ CurrentState: currentState, TargetState: targetState, @@ -7625,7 +7625,7 @@ func Test_Sync_DegraphqlRoutes(t *testing.T) { currentState, err := fetchCurrentState(ctx, client, dumpConfig) require.NoError(t, err) - targetState := stateFromFile(ctx, t, "testdata/sync/036-degraphql-routes/kong-complex-query.yaml", client, dumpConfig) + targetState := stateFromFile(ctx, t, "testdata/sync/037-degraphql-routes/kong-complex-query.yaml", client, dumpConfig) syncer, err := deckDiff.NewSyncer(deckDiff.SyncerOpts{ CurrentState: currentState, TargetState: targetState, @@ -7654,3 +7654,11 @@ func Test_Sync_DegraphqlRoutes(t *testing.T) { assert.Equal(t, expectedMethods, degraphqlRoutes[0].Methods) }) } + +func Test_Sync_CustomEntities_Fake(t *testing.T) { + runWhen(t, "enterprise", ">=3.0.0") + setup(t) + err := sync("testdata/sync/037-degraphql-routes/kong-fake-entity.yaml") + require.Error(t, err) + assert.ErrorContains(t, err, "unknown entity type: fake-entity") +} diff --git a/tests/integration/testdata/sync/036-degraphql-routes/kong-complex-query.yaml b/tests/integration/testdata/sync/037-degraphql-routes/kong-complex-query.yaml similarity index 100% rename from tests/integration/testdata/sync/036-degraphql-routes/kong-complex-query.yaml rename to tests/integration/testdata/sync/037-degraphql-routes/kong-complex-query.yaml diff --git a/tests/integration/testdata/sync/037-degraphql-routes/kong-fake-entity.yaml b/tests/integration/testdata/sync/037-degraphql-routes/kong-fake-entity.yaml new file mode 100644 index 0000000..d764327 --- /dev/null +++ b/tests/integration/testdata/sync/037-degraphql-routes/kong-fake-entity.yaml @@ -0,0 +1,5 @@ +_format_version: "3.0" +custom_entities: +- type: fake-entity + fields: + foo: bar \ No newline at end of file diff --git a/tests/integration/testdata/sync/036-degraphql-routes/kong.yaml b/tests/integration/testdata/sync/037-degraphql-routes/kong.yaml similarity index 100% rename from tests/integration/testdata/sync/036-degraphql-routes/kong.yaml rename to tests/integration/testdata/sync/037-degraphql-routes/kong.yaml