Browse Source

Merge pull request #13845 from hashicorp/acpana/peering-rename-oss

[SYNC] Rename peering internal to ~
pull/13848/head
alex 2 years ago committed by GitHub
parent
commit
58d66a002e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 80
      agent/consul/state/catalog_oss_test.go
  2. 2
      agent/structs/structs.go

80
agent/consul/state/catalog_oss_test.go

@ -34,11 +34,11 @@ func testIndexerTableChecks() map[string]indexerTestCase {
Node: "NoDe", Node: "NoDe",
CheckID: "CheckId", CheckID: "CheckId",
}, },
expected: []byte("internal\x00node\x00checkid\x00"), expected: []byte("~\x00node\x00checkid\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00node\x00checkid\x00"), expected: []byte("~\x00node\x00checkid\x00"),
}, },
prefix: []indexValue{ prefix: []indexValue{
{ {
@ -47,7 +47,7 @@ func testIndexerTableChecks() map[string]indexerTestCase {
}, },
{ {
source: Query{Value: "nOdE"}, source: Query{Value: "nOdE"},
expected: []byte("internal\x00node\x00"), expected: []byte("~\x00node\x00"),
}, },
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
@ -77,11 +77,11 @@ func testIndexerTableChecks() map[string]indexerTestCase {
indexStatus: { indexStatus: {
read: indexValue{ read: indexValue{
source: Query{Value: "PASSING"}, source: Query{Value: "PASSING"},
expected: []byte("internal\x00passing\x00"), expected: []byte("~\x00passing\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00passing\x00"), expected: []byte("~\x00passing\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -99,11 +99,11 @@ func testIndexerTableChecks() map[string]indexerTestCase {
indexService: { indexService: {
read: indexValue{ read: indexValue{
source: Query{Value: "ServiceName"}, source: Query{Value: "ServiceName"},
expected: []byte("internal\x00servicename\x00"), expected: []byte("~\x00servicename\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00servicename\x00"), expected: []byte("~\x00servicename\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -124,11 +124,11 @@ func testIndexerTableChecks() map[string]indexerTestCase {
Node: "NoDe", Node: "NoDe",
Service: "SeRvIcE", Service: "SeRvIcE",
}, },
expected: []byte("internal\x00node\x00service\x00"), expected: []byte("~\x00node\x00service\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00node\x00service\x00"), expected: []byte("~\x00node\x00service\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -152,11 +152,11 @@ func testIndexerTableChecks() map[string]indexerTestCase {
source: Query{ source: Query{
Value: "NoDe", Value: "NoDe",
}, },
expected: []byte("internal\x00node\x00"), expected: []byte("~\x00node\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00node\x00"), expected: []byte("~\x00node\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -272,11 +272,11 @@ func testIndexerTableNodes() map[string]indexerTestCase {
indexID: { indexID: {
read: indexValue{ read: indexValue{
source: Query{Value: "NoDeId"}, source: Query{Value: "NoDeId"},
expected: []byte("internal\x00nodeid\x00"), expected: []byte("~\x00nodeid\x00"),
}, },
write: indexValue{ write: indexValue{
source: &structs.Node{Node: "NoDeId"}, source: &structs.Node{Node: "NoDeId"},
expected: []byte("internal\x00nodeid\x00"), expected: []byte("~\x00nodeid\x00"),
}, },
prefix: []indexValue{ prefix: []indexValue{
{ {
@ -289,11 +289,11 @@ func testIndexerTableNodes() map[string]indexerTestCase {
}, },
{ {
source: Query{Value: "NoDeId"}, source: Query{Value: "NoDeId"},
expected: []byte("internal\x00nodeid\x00"), expected: []byte("~\x00nodeid\x00"),
}, },
{ {
source: Query{}, source: Query{},
expected: []byte("internal\x00"), expected: []byte("~\x00"),
}, },
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
@ -322,27 +322,27 @@ func testIndexerTableNodes() map[string]indexerTestCase {
indexUUID: { indexUUID: {
read: indexValue{ read: indexValue{
source: Query{Value: uuid}, source: Query{Value: uuid},
expected: append([]byte("internal\x00"), uuidBuf...), expected: append([]byte("~\x00"), uuidBuf...),
}, },
write: indexValue{ write: indexValue{
source: &structs.Node{ source: &structs.Node{
ID: types.NodeID(uuid), ID: types.NodeID(uuid),
Node: "NoDeId", Node: "NoDeId",
}, },
expected: append([]byte("internal\x00"), uuidBuf...), expected: append([]byte("~\x00"), uuidBuf...),
}, },
prefix: []indexValue{ prefix: []indexValue{
{ // partial length { // partial length
source: Query{Value: uuid[:6]}, source: Query{Value: uuid[:6]},
expected: append([]byte("internal\x00"), uuidBuf[:3]...), expected: append([]byte("~\x00"), uuidBuf[:3]...),
}, },
{ // full length { // full length
source: Query{Value: uuid}, source: Query{Value: uuid},
expected: append([]byte("internal\x00"), uuidBuf...), expected: append([]byte("~\x00"), uuidBuf...),
}, },
{ {
source: Query{}, source: Query{},
expected: []byte("internal\x00"), expected: []byte("~\x00"),
}, },
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
@ -382,7 +382,7 @@ func testIndexerTableNodes() map[string]indexerTestCase {
Key: "KeY", Key: "KeY",
Value: "VaLuE", Value: "VaLuE",
}, },
expected: []byte("internal\x00KeY\x00VaLuE\x00"), expected: []byte("~\x00KeY\x00VaLuE\x00"),
}, },
writeMulti: indexValueMulti{ writeMulti: indexValueMulti{
source: &structs.Node{ source: &structs.Node{
@ -393,8 +393,8 @@ func testIndexerTableNodes() map[string]indexerTestCase {
}, },
}, },
expected: [][]byte{ expected: [][]byte{
[]byte("internal\x00MaP-kEy-1\x00mAp-VaL-1\x00"), []byte("~\x00MaP-kEy-1\x00mAp-VaL-1\x00"),
[]byte("internal\x00mAp-KeY-2\x00MaP-vAl-2\x00"), []byte("~\x00mAp-KeY-2\x00MaP-vAl-2\x00"),
}, },
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
@ -449,11 +449,11 @@ func testIndexerTableServices() map[string]indexerTestCase {
Node: "NoDeId", Node: "NoDeId",
Service: "SeRvIcE", Service: "SeRvIcE",
}, },
expected: []byte("internal\x00nodeid\x00service\x00"), expected: []byte("~\x00nodeid\x00service\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00nodeid\x00service\x00"), expected: []byte("~\x00nodeid\x00service\x00"),
}, },
prefix: []indexValue{ prefix: []indexValue{
{ {
@ -466,11 +466,11 @@ func testIndexerTableServices() map[string]indexerTestCase {
}, },
{ {
source: Query{}, source: Query{},
expected: []byte("internal\x00"), expected: []byte("~\x00"),
}, },
{ {
source: Query{Value: "NoDeId"}, source: Query{Value: "NoDeId"},
expected: []byte("internal\x00nodeid\x00"), expected: []byte("~\x00nodeid\x00"),
}, },
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
@ -505,11 +505,11 @@ func testIndexerTableServices() map[string]indexerTestCase {
source: Query{ source: Query{
Value: "NoDeId", Value: "NoDeId",
}, },
expected: []byte("internal\x00nodeid\x00"), expected: []byte("~\x00nodeid\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00nodeid\x00"), expected: []byte("~\x00nodeid\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -530,11 +530,11 @@ func testIndexerTableServices() map[string]indexerTestCase {
indexService: { indexService: {
read: indexValue{ read: indexValue{
source: Query{Value: "ServiceName"}, source: Query{Value: "ServiceName"},
expected: []byte("internal\x00servicename\x00"), expected: []byte("~\x00servicename\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00servicename\x00"), expected: []byte("~\x00servicename\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -552,14 +552,14 @@ func testIndexerTableServices() map[string]indexerTestCase {
indexConnect: { indexConnect: {
read: indexValue{ read: indexValue{
source: Query{Value: "ConnectName"}, source: Query{Value: "ConnectName"},
expected: []byte("internal\x00connectname\x00"), expected: []byte("~\x00connectname\x00"),
}, },
write: indexValue{ write: indexValue{
source: &structs.ServiceNode{ source: &structs.ServiceNode{
ServiceName: "ConnectName", ServiceName: "ConnectName",
ServiceConnect: structs.ServiceConnect{Native: true}, ServiceConnect: structs.ServiceConnect{Native: true},
}, },
expected: []byte("internal\x00connectname\x00"), expected: []byte("~\x00connectname\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -571,7 +571,7 @@ func testIndexerTableServices() map[string]indexerTestCase {
DestinationServiceName: "ConnectName", DestinationServiceName: "ConnectName",
}, },
}, },
expected: []byte("internal\x00connectname\x00"), expected: []byte("~\x00connectname\x00"),
}, },
}, },
{ {
@ -621,13 +621,13 @@ func testIndexerTableServices() map[string]indexerTestCase {
indexKind: { indexKind: {
read: indexValue{ read: indexValue{
source: Query{Value: "connect-proxy"}, source: Query{Value: "connect-proxy"},
expected: []byte("internal\x00connect-proxy\x00"), expected: []byte("~\x00connect-proxy\x00"),
}, },
write: indexValue{ write: indexValue{
source: &structs.ServiceNode{ source: &structs.ServiceNode{
ServiceKind: structs.ServiceKindConnectProxy, ServiceKind: structs.ServiceKindConnectProxy,
}, },
expected: []byte("internal\x00connect-proxy\x00"), expected: []byte("~\x00connect-proxy\x00"),
}, },
extra: []indexerTestCase{ extra: []indexerTestCase{
{ {
@ -636,7 +636,7 @@ func testIndexerTableServices() map[string]indexerTestCase {
ServiceName: "ServiceName", ServiceName: "ServiceName",
ServiceKind: structs.ServiceKindTypical, ServiceKind: structs.ServiceKindTypical,
}, },
expected: []byte("internal\x00\x00"), expected: []byte("~\x00\x00"),
}, },
}, },
{ {
@ -694,18 +694,18 @@ func testIndexerTableServiceVirtualIPs() map[string]indexerTestCase {
Name: "foo", Name: "foo",
}, },
}, },
expected: []byte("internal\x00foo\x00"), expected: []byte("~\x00foo\x00"),
}, },
write: indexValue{ write: indexValue{
source: obj, source: obj,
expected: []byte("internal\x00foo\x00"), expected: []byte("~\x00foo\x00"),
}, },
prefix: []indexValue{ prefix: []indexValue{
{ {
source: Query{ source: Query{
Value: "foo", Value: "foo",
}, },
expected: []byte("internal\x00foo\x00"), expected: []byte("~\x00foo\x00"),
}, },
{ {
source: Query{ source: Query{

2
agent/structs/structs.go

@ -88,7 +88,7 @@ const (
const ( const (
// LocalPeerKeyword is a reserved keyword used for indexing in the state store for objects in the local peer. // LocalPeerKeyword is a reserved keyword used for indexing in the state store for objects in the local peer.
LocalPeerKeyword = "internal" LocalPeerKeyword = "~"
// DefaultPeerKeyword is the PeerName to use to refer to the local // DefaultPeerKeyword is the PeerName to use to refer to the local
// cluster's own data, rather than replicated peered data. // cluster's own data, rather than replicated peered data.

Loading…
Cancel
Save