2023-03-28 18:39:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-11-16 18:04:01 +00:00
|
|
|
//go:build !consulent
|
2021-08-17 18:29:39 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package state
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
import (
|
|
|
|
"github.com/hashicorp/consul/acl"
|
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
|
|
|
)
|
2021-08-17 18:29:39 +00:00
|
|
|
|
|
|
|
func testIndexerTableCoordinates() map[string]indexerTestCase {
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: CoordinateQuery{
|
|
|
|
Node: "NoDeId",
|
|
|
|
Segment: "SeGmEnT",
|
|
|
|
},
|
|
|
|
expected: []byte("nodeid\x00segment\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.Coordinate{
|
|
|
|
Node: "NoDeId",
|
|
|
|
Segment: "SeGmEnT",
|
|
|
|
},
|
|
|
|
expected: []byte("nodeid\x00segment\x00"),
|
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{
|
2022-04-05 21:10:06 +00:00
|
|
|
source: (*acl.EnterpriseMeta)(nil),
|
2021-08-17 18:29:39 +00:00
|
|
|
expected: nil,
|
|
|
|
},
|
|
|
|
{
|
2022-04-05 21:10:06 +00:00
|
|
|
source: acl.EnterpriseMeta{},
|
2021-08-17 18:29:39 +00:00
|
|
|
expected: nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{Value: "NoDeId"},
|
|
|
|
expected: []byte("nodeid\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indexNode: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{
|
|
|
|
Value: "NoDeId",
|
|
|
|
},
|
|
|
|
expected: []byte("nodeid\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.Coordinate{
|
|
|
|
Node: "NoDeId",
|
|
|
|
},
|
|
|
|
expected: []byte("nodeid\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|