From 920ae31598add1dfc9886209a8ba58651b2ea48a Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Fri, 21 May 2021 13:44:30 -0400 Subject: [PATCH] structs: add two cache completeness tests types that implement cache.Request --- agent/structs/intention_test.go | 9 ++++++++- agent/structs/prepared_query_test.go | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/agent/structs/intention_test.go b/agent/structs/intention_test.go index be63060184..9b843aaee4 100644 --- a/agent/structs/intention_test.go +++ b/agent/structs/intention_test.go @@ -5,9 +5,10 @@ import ( "strings" "testing" - "github.com/hashicorp/consul/acl" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/hashicorp/consul/acl" ) func TestIntention_ACLs(t *testing.T) { @@ -453,3 +454,9 @@ func TestIntention_String(t *testing.T) { }) } } + +func TestIntentionQueryRequest_CacheInfoKey(t *testing.T) { + // TODO: should these fields be included in the key? + ignored := []string{"IntentionID", "Check", "Exact", "QueryOptions"} + assertCacheInfoKeyIsComplete(t, &IntentionQueryRequest{}, ignored...) +} diff --git a/agent/structs/prepared_query_test.go b/agent/structs/prepared_query_test.go index 6a629874b4..d77ba3578b 100644 --- a/agent/structs/prepared_query_test.go +++ b/agent/structs/prepared_query_test.go @@ -27,3 +27,9 @@ func TestStructs_PreparedQuery_GetACLPrefix(t *testing.T) { t.Fatalf("bad: ok=%v prefix=%#v", ok, prefix) } } + +func TestPreparedQueryExecuteRequest_CacheInfoKey(t *testing.T) { + // TODO: should these fields be included in the key? + ignored := []string{"Agent", "QueryOptions"} + assertCacheInfoKeyIsComplete(t, &PreparedQueryExecuteRequest{}, ignored...) +}