structs: add two cache completeness tests types that implement cache.Request

This commit is contained in:
Daniel Nephin 2021-05-21 13:44:30 -04:00
parent 46dfdb611f
commit 920ae31598
2 changed files with 14 additions and 1 deletions

View File

@ -5,9 +5,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/consul/acl"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/hashicorp/consul/acl"
) )
func TestIntention_ACLs(t *testing.T) { 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...)
}

View File

@ -27,3 +27,9 @@ func TestStructs_PreparedQuery_GetACLPrefix(t *testing.T) {
t.Fatalf("bad: ok=%v prefix=%#v", ok, prefix) 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...)
}