From 25287944f2e6cd2f172c2593ff326c0ef92656a9 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 7 Jan 2022 11:30:31 -0500 Subject: [PATCH] fix remaining tests --- agent/proxycfg/state_test.go | 10 ++++++---- agent/proxycfg/terminating_gateway.go | 4 ++-- agent/proxycfg/testing.go | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/agent/proxycfg/state_test.go b/agent/proxycfg/state_test.go index 6e2392d75a..52f0de5c85 100644 --- a/agent/proxycfg/state_test.go +++ b/agent/proxycfg/state_test.go @@ -657,14 +657,16 @@ func TestState_WatchesAndUpdates(t *testing.T) { }, { CorrelationID: envoyConfigPatchesID, - Result: structs.IndexedConfigEntries{ + Result: &structs.IndexedConfigEntries{ + Kind: structs.EnvoyPatchSet, Entries: []structs.ConfigEntry{envoyPatchSet}, }, Err: nil, }, { CorrelationID: envoyConfigApplicationID, - Result: structs.IndexedConfigEntries{ + Result: &structs.IndexedConfigEntries{ + Kind: structs.ApplyEnvoyPatchSet, Entries: []structs.ConfigEntry{serviceEnvoyPatchSetApplication, envoyPatchSetApplication}, }, Err: nil, @@ -1660,14 +1662,14 @@ func TestState_WatchesAndUpdates(t *testing.T) { events: []cache.UpdateEvent{ { CorrelationID: envoyConfigPatchesID, - Result: structs.IndexedConfigEntries{ + Result: &structs.IndexedConfigEntries{ Entries: []structs.ConfigEntry{envoyPatchSet}, }, Err: nil, }, { CorrelationID: envoyConfigApplicationID, - Result: structs.IndexedConfigEntries{ + Result: &structs.IndexedConfigEntries{ Entries: []structs.ConfigEntry{serviceEnvoyPatchSetApplication, envoyPatchSetApplication}, }, Err: nil, diff --git a/agent/proxycfg/terminating_gateway.go b/agent/proxycfg/terminating_gateway.go index b9b4289f0f..762b752b0d 100644 --- a/agent/proxycfg/terminating_gateway.go +++ b/agent/proxycfg/terminating_gateway.go @@ -99,7 +99,7 @@ func (s *handlerTerminatingGateway) handleUpdate(ctx context.Context, u cache.Up configEntries, ok := u.Result.(*structs.IndexedConfigEntries) if !ok { - return fmt.Errorf("invalid type for response thingy: %T, %+v", u.Result, u.Result) + return fmt.Errorf("invalid type for response thingy: %T", u.Result) } patchSet := make(map[structs.ApplyEnvoyPatchSetIdentifier]*structs.EnvoyPatchSetConfigEntry) @@ -107,7 +107,7 @@ func (s *handlerTerminatingGateway) handleUpdate(ctx context.Context, u cache.Up envoyConfigPatch, ok := e.(*structs.EnvoyPatchSetConfigEntry) if !ok { - return fmt.Errorf("invalid type for response stuff: %T, %+v", u.Result, u.Result) + return fmt.Errorf("invalid type for response stuff: %T", u.Result) } patchSet[envoyConfigPatch.GetEnvoyPatchSetIdentifier()] = envoyConfigPatch } diff --git a/agent/proxycfg/testing.go b/agent/proxycfg/testing.go index e2aaafdc07..8c7dffd559 100644 --- a/agent/proxycfg/testing.go +++ b/agent/proxycfg/testing.go @@ -33,6 +33,7 @@ type TestCacheTypes struct { query *ControllableCacheType compiledChain *ControllableCacheType serviceHTTPChecks *ControllableCacheType + configEntries *ControllableCacheType } // NewTestCacheTypes creates a set of ControllableCacheTypes for all types that @@ -47,6 +48,7 @@ func NewTestCacheTypes(t testing.T) *TestCacheTypes { query: NewControllableCacheType(t), compiledChain: NewControllableCacheType(t), serviceHTTPChecks: NewControllableCacheType(t), + configEntries: NewControllableCacheType(t), } ct.query.blocking = false return ct @@ -63,6 +65,7 @@ func TestCacheWithTypes(t testing.T, types *TestCacheTypes) *cache.Cache { c.RegisterType(cachetype.PreparedQueryName, types.query) c.RegisterType(cachetype.CompiledDiscoveryChainName, types.compiledChain) c.RegisterType(cachetype.ServiceHTTPChecksName, types.serviceHTTPChecks) + c.RegisterType(cachetype.ConfigEntriesName, types.configEntries) return c }