2021-11-16 18:04:01 +00:00
|
|
|
//go:build !consulent
|
2021-02-19 19:38:07 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package state
|
|
|
|
|
2021-03-22 21:29:58 +00:00
|
|
|
import (
|
2021-12-02 23:42:47 +00:00
|
|
|
"net"
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2021-03-22 21:29:58 +00:00
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
2021-08-19 21:17:59 +00:00
|
|
|
"github.com/hashicorp/consul/types"
|
2021-03-22 21:29:58 +00:00
|
|
|
)
|
2021-02-19 19:38:07 +00:00
|
|
|
|
|
|
|
func testIndexerTableChecks() map[string]indexerTestCase {
|
2021-03-22 21:29:58 +00:00
|
|
|
obj := &structs.HealthCheck{
|
2021-03-29 20:07:49 +00:00
|
|
|
Node: "NoDe",
|
|
|
|
ServiceID: "SeRvIcE",
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
CheckID: "CheckID",
|
|
|
|
Status: "PASSING",
|
2021-03-22 21:29:58 +00:00
|
|
|
}
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
objWPeer := &structs.HealthCheck{
|
|
|
|
Node: "NoDe",
|
|
|
|
ServiceID: "SeRvIcE",
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
CheckID: "CheckID",
|
|
|
|
Status: "PASSING",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
}
|
2021-02-19 19:38:07 +00:00
|
|
|
return map[string]indexerTestCase{
|
2021-03-22 21:29:58 +00:00
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: NodeCheckQuery{
|
|
|
|
Node: "NoDe",
|
|
|
|
CheckID: "CheckId",
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00node\x00checkid\x00"),
|
2021-03-22 21:29:58 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00node\x00checkid\x00"),
|
2021-03-22 21:29:58 +00:00
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{
|
2022-04-05 21:10:06 +00:00
|
|
|
source: acl.EnterpriseMeta{},
|
2021-03-22 21:29:58 +00:00
|
|
|
expected: nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{Value: "nOdE"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00node\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: NodeCheckQuery{
|
|
|
|
Node: "NoDe",
|
|
|
|
CheckID: "CheckId",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00node\x00checkid\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00node\x00checkid\x00"),
|
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{
|
|
|
|
source: Query{Value: "nOdE",
|
|
|
|
PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00node\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-03-22 21:29:58 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-03-29 20:07:49 +00:00
|
|
|
indexStatus: {
|
|
|
|
read: indexValue{
|
2021-03-29 20:29:04 +00:00
|
|
|
source: Query{Value: "PASSING"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00passing\x00"),
|
2021-03-29 20:07:49 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00passing\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "PASSING", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00passing\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00passing\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-03-29 20:07:49 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
indexService: {
|
|
|
|
read: indexValue{
|
2021-03-29 20:37:37 +00:00
|
|
|
source: Query{Value: "ServiceName"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00servicename\x00"),
|
2021-03-29 20:07:49 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00servicename\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "ServiceName", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00servicename\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00servicename\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-03-29 20:07:49 +00:00
|
|
|
},
|
|
|
|
},
|
2021-02-19 19:38:07 +00:00
|
|
|
indexNodeService: {
|
|
|
|
read: indexValue{
|
|
|
|
source: NodeServiceQuery{
|
|
|
|
Node: "NoDe",
|
|
|
|
Service: "SeRvIcE",
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00node\x00service\x00"),
|
2021-02-19 19:38:07 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
2021-03-22 21:29:58 +00:00
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00node\x00service\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: NodeServiceQuery{
|
|
|
|
Node: "NoDe",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
Service: "SeRvIcE",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00node\x00service\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00node\x00service\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-02-19 19:38:07 +00:00
|
|
|
},
|
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
indexNode: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{
|
|
|
|
Value: "NoDe",
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00node\x00"),
|
2021-02-12 22:31:02 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
2021-03-22 21:29:58 +00:00
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00node\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{
|
|
|
|
Value: "NoDe",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00node\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00node\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
},
|
|
|
|
},
|
2021-02-19 19:38:07 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-19 23:18:25 +00:00
|
|
|
|
2021-03-16 17:30:07 +00:00
|
|
|
func testIndexerTableMeshTopology() map[string]indexerTestCase {
|
2021-03-16 17:37:44 +00:00
|
|
|
obj := upstreamDownstream{
|
2021-03-16 17:30:07 +00:00
|
|
|
Upstream: structs.ServiceName{Name: "UpStReAm"},
|
|
|
|
Downstream: structs.ServiceName{Name: "DownStream"},
|
|
|
|
}
|
|
|
|
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: []interface{}{
|
|
|
|
structs.ServiceName{Name: "UpStReAm"},
|
|
|
|
structs.ServiceName{Name: "DownStream"},
|
|
|
|
},
|
|
|
|
expected: []byte("upstream\x00downstream\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("upstream\x00downstream\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indexUpstream: {
|
|
|
|
read: indexValue{
|
2021-03-16 18:20:11 +00:00
|
|
|
source: structs.ServiceName{Name: "UpStReAm"},
|
2021-03-16 17:30:07 +00:00
|
|
|
expected: []byte("upstream\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("upstream\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indexDownstream: {
|
|
|
|
read: indexValue{
|
2021-03-16 18:20:11 +00:00
|
|
|
source: structs.ServiceName{Name: "DownStream"},
|
2021-03-16 17:30:07 +00:00
|
|
|
expected: []byte("downstream\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("downstream\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-16 18:20:11 +00:00
|
|
|
func testIndexerTableGatewayServices() map[string]indexerTestCase {
|
|
|
|
obj := &structs.GatewayService{
|
|
|
|
Gateway: structs.ServiceName{Name: "GateWay"},
|
|
|
|
Service: structs.ServiceName{Name: "SerVice"},
|
|
|
|
Port: 50123,
|
|
|
|
}
|
|
|
|
encodedPort := string([]byte{0x96, 0x8f, 0x06, 0, 0, 0, 0, 0, 0, 0})
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: []interface{}{
|
|
|
|
structs.ServiceName{Name: "GateWay"},
|
|
|
|
structs.ServiceName{Name: "SerVice"},
|
|
|
|
50123,
|
|
|
|
},
|
|
|
|
expected: []byte("gateway\x00service\x00" + encodedPort),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("gateway\x00service\x00" + encodedPort),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indexGateway: {
|
|
|
|
read: indexValue{
|
|
|
|
source: structs.ServiceName{Name: "GateWay"},
|
|
|
|
expected: []byte("gateway\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("gateway\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indexService: {
|
|
|
|
read: indexValue{
|
|
|
|
source: structs.ServiceName{Name: "SerVice"},
|
|
|
|
expected: []byte("service\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("service\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-19 23:18:25 +00:00
|
|
|
func testIndexerTableNodes() map[string]indexerTestCase {
|
2021-08-19 21:17:59 +00:00
|
|
|
uuidBuf, uuid := generateUUID()
|
|
|
|
|
2021-02-19 23:18:25 +00:00
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "NoDeId"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00"),
|
2021-02-19 23:18:25 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.Node{Node: "NoDeId"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00"),
|
2021-02-19 23:18:25 +00:00
|
|
|
},
|
2021-08-17 18:29:39 +00:00
|
|
|
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"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "NoDeId", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00nodeid\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.Node{Node: "NoDeId", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00nodeid\x00"),
|
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{
|
|
|
|
source: Query{PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{Value: "NoDeId", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00nodeid\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-08-17 18:29:39 +00:00
|
|
|
},
|
|
|
|
},
|
2021-02-19 23:18:25 +00:00
|
|
|
},
|
2021-08-19 21:17:59 +00:00
|
|
|
indexUUID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: uuid},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: append([]byte("~\x00"), uuidBuf...),
|
2021-08-19 21:17:59 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.Node{
|
|
|
|
ID: types.NodeID(uuid),
|
|
|
|
Node: "NoDeId",
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: append([]byte("~\x00"), uuidBuf...),
|
2021-08-19 21:17:59 +00:00
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{ // partial length
|
|
|
|
source: Query{Value: uuid[:6]},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: append([]byte("~\x00"), uuidBuf[:3]...),
|
2021-08-19 21:17:59 +00:00
|
|
|
},
|
|
|
|
{ // full length
|
|
|
|
source: Query{Value: uuid},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: append([]byte("~\x00"), uuidBuf...),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: uuid, PeerName: "Peer1"},
|
|
|
|
expected: append([]byte("peer1\x00"), uuidBuf...),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.Node{
|
|
|
|
ID: types.NodeID(uuid),
|
|
|
|
PeerName: "Peer1",
|
|
|
|
Node: "NoDeId",
|
|
|
|
},
|
|
|
|
expected: append([]byte("peer1\x00"), uuidBuf...),
|
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{ // partial length
|
|
|
|
source: Query{Value: uuid[:6], PeerName: "Peer1"},
|
|
|
|
expected: append([]byte("peer1\x00"), uuidBuf[:3]...),
|
|
|
|
},
|
|
|
|
{ // full length
|
|
|
|
source: Query{Value: uuid, PeerName: "Peer1"},
|
|
|
|
expected: append([]byte("peer1\x00"), uuidBuf...),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-08-19 21:17:59 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indexMeta: {
|
|
|
|
read: indexValue{
|
|
|
|
source: KeyValueQuery{
|
|
|
|
Key: "KeY",
|
|
|
|
Value: "VaLuE",
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00KeY\x00VaLuE\x00"),
|
2021-08-19 21:17:59 +00:00
|
|
|
},
|
|
|
|
writeMulti: indexValueMulti{
|
|
|
|
source: &structs.Node{
|
|
|
|
Node: "NoDeId",
|
|
|
|
Meta: map[string]string{
|
|
|
|
"MaP-kEy-1": "mAp-VaL-1",
|
|
|
|
"mAp-KeY-2": "MaP-vAl-2",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
expected: [][]byte{
|
2022-07-21 17:51:05 +00:00
|
|
|
[]byte("~\x00MaP-kEy-1\x00mAp-VaL-1\x00"),
|
|
|
|
[]byte("~\x00mAp-KeY-2\x00MaP-vAl-2\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: KeyValueQuery{
|
|
|
|
Key: "KeY",
|
|
|
|
Value: "VaLuE",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00KeY\x00VaLuE\x00"),
|
|
|
|
},
|
|
|
|
writeMulti: indexValueMulti{
|
|
|
|
source: &structs.Node{
|
|
|
|
Node: "NoDeId",
|
|
|
|
Meta: map[string]string{
|
|
|
|
"MaP-kEy-1": "mAp-VaL-1",
|
|
|
|
"mAp-KeY-2": "MaP-vAl-2",
|
|
|
|
},
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: [][]byte{
|
|
|
|
[]byte("peer1\x00MaP-kEy-1\x00mAp-VaL-1\x00"),
|
|
|
|
[]byte("peer1\x00mAp-KeY-2\x00MaP-vAl-2\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-08-19 21:17:59 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-08-17 18:29:39 +00:00
|
|
|
|
|
|
|
// TODO(partitions): fix schema tests for tables that reference nodes too
|
2021-02-19 23:18:25 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-12 22:31:02 +00:00
|
|
|
|
|
|
|
func testIndexerTableServices() map[string]indexerTestCase {
|
2021-03-26 20:11:03 +00:00
|
|
|
obj := &structs.ServiceNode{
|
|
|
|
Node: "NoDeId",
|
|
|
|
ServiceID: "SeRviCe",
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
}
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
objWPeer := &structs.ServiceNode{
|
|
|
|
Node: "NoDeId",
|
|
|
|
ServiceID: "SeRviCe",
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
}
|
2021-03-26 20:11:03 +00:00
|
|
|
|
2021-02-12 22:31:02 +00:00
|
|
|
return map[string]indexerTestCase{
|
2021-03-10 23:34:19 +00:00
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: NodeServiceQuery{
|
|
|
|
Node: "NoDeId",
|
|
|
|
Service: "SeRvIcE",
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00service\x00"),
|
2021-03-10 23:34:19 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
2021-03-26 20:11:03 +00:00
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00service\x00"),
|
2021-03-10 23:34:19 +00:00
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{
|
2022-04-05 21:10:06 +00:00
|
|
|
source: (*acl.EnterpriseMeta)(nil),
|
2021-03-10 23:34:19 +00:00
|
|
|
expected: nil,
|
|
|
|
},
|
|
|
|
{
|
2022-04-05 21:10:06 +00:00
|
|
|
source: acl.EnterpriseMeta{},
|
2021-03-10 23:34:19 +00:00
|
|
|
expected: nil,
|
|
|
|
},
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
{
|
|
|
|
source: Query{},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
2021-03-10 23:34:19 +00:00
|
|
|
{
|
|
|
|
source: Query{Value: "NoDeId"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: NodeServiceQuery{
|
|
|
|
Node: "NoDeId",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
Service: "SeRvIcE",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00nodeid\x00service\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00nodeid\x00service\x00"),
|
|
|
|
},
|
|
|
|
prefix: []indexValue{
|
|
|
|
{
|
|
|
|
source: Query{Value: "NoDeId", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00nodeid\x00"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-03-10 23:34:19 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
indexNode: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{
|
2021-03-26 20:11:03 +00:00
|
|
|
Value: "NoDeId",
|
2021-02-12 22:31:02 +00:00
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00"),
|
2021-03-26 20:11:03 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00nodeid\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{
|
|
|
|
Value: "NoDeId",
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00nodeid\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00nodeid\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-03-26 20:11:03 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
indexService: {
|
|
|
|
read: indexValue{
|
2021-03-26 21:21:38 +00:00
|
|
|
source: Query{Value: "ServiceName"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00servicename\x00"),
|
2021-03-26 20:11:03 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00servicename\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "ServiceName", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00servicename\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: objWPeer,
|
|
|
|
expected: []byte("peer1\x00servicename\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-03-26 20:11:03 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
indexConnect: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "ConnectName"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00connectname\x00"),
|
2021-02-12 22:31:02 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
2021-03-26 20:11:03 +00:00
|
|
|
ServiceName: "ConnectName",
|
|
|
|
ServiceConnect: structs.ServiceConnect{Native: true},
|
2021-02-12 22:31:02 +00:00
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00connectname\x00"),
|
2021-02-12 22:31:02 +00:00
|
|
|
},
|
2021-03-31 18:37:21 +00:00
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
ServiceKind: structs.ServiceKindConnectProxy,
|
|
|
|
ServiceProxy: structs.ConnectProxyConfig{
|
|
|
|
DestinationServiceName: "ConnectName",
|
|
|
|
},
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00connectname\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
ServiceKind: structs.ServiceKindConnectProxy,
|
|
|
|
ServiceProxy: structs.ConnectProxyConfig{
|
|
|
|
DestinationServiceName: "ConnectName",
|
|
|
|
},
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00connectname\x00"),
|
2021-03-31 18:37:21 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{ServiceName: "ServiceName"},
|
|
|
|
expectedIndexMissing: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
ServiceKind: structs.ServiceKindTerminatingGateway,
|
|
|
|
},
|
|
|
|
expectedIndexMissing: true,
|
|
|
|
},
|
|
|
|
},
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "ConnectName", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00connectname\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceName: "ConnectName",
|
|
|
|
ServiceConnect: structs.ServiceConnect{Native: true},
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00connectname\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-03-31 18:37:21 +00:00
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
},
|
2021-03-26 22:11:41 +00:00
|
|
|
indexKind: {
|
|
|
|
read: indexValue{
|
2021-03-26 22:38:52 +00:00
|
|
|
source: Query{Value: "connect-proxy"},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00connect-proxy\x00"),
|
2021-03-26 22:11:41 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceKind: structs.ServiceKindConnectProxy,
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00connect-proxy\x00"),
|
2021-03-26 22:11:41 +00:00
|
|
|
},
|
2021-03-31 18:37:21 +00:00
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
ServiceKind: structs.ServiceKindTypical,
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00\x00"),
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceName: "ServiceName",
|
|
|
|
ServiceKind: structs.ServiceKindTypical,
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "connect-proxy", PeerName: "Peer1"},
|
|
|
|
expected: []byte("peer1\x00connect-proxy\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
ServiceKind: structs.ServiceKindConnectProxy,
|
|
|
|
PeerName: "Peer1",
|
|
|
|
},
|
|
|
|
expected: []byte("peer1\x00connect-proxy\x00"),
|
2021-03-31 18:37:21 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-03-26 22:11:41 +00:00
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-02 23:42:47 +00:00
|
|
|
|
|
|
|
func testIndexerTableServiceVirtualIPs() map[string]indexerTestCase {
|
|
|
|
obj := ServiceVirtualIP{
|
2022-06-24 18:38:39 +00:00
|
|
|
Service: structs.PeeredServiceName{
|
|
|
|
ServiceName: structs.ServiceName{
|
|
|
|
Name: "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
IP: net.ParseIP("127.0.0.1"),
|
|
|
|
}
|
|
|
|
peeredObj := ServiceVirtualIP{
|
|
|
|
Service: structs.PeeredServiceName{
|
|
|
|
ServiceName: structs.ServiceName{
|
|
|
|
Name: "foo",
|
|
|
|
},
|
|
|
|
Peer: "Billing",
|
2021-12-02 23:42:47 +00:00
|
|
|
},
|
|
|
|
IP: net.ParseIP("127.0.0.1"),
|
|
|
|
}
|
|
|
|
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
2022-06-24 18:38:39 +00:00
|
|
|
source: structs.PeeredServiceName{
|
|
|
|
ServiceName: structs.ServiceName{
|
|
|
|
Name: "foo",
|
|
|
|
},
|
2021-12-02 23:42:47 +00:00
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00foo\x00"),
|
2021-12-02 23:42:47 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00foo\x00"),
|
2022-06-24 18:38:39 +00:00
|
|
|
},
|
2022-06-29 20:34:58 +00:00
|
|
|
prefix: []indexValue{
|
|
|
|
{
|
|
|
|
source: Query{
|
|
|
|
Value: "foo",
|
|
|
|
},
|
2022-07-21 17:51:05 +00:00
|
|
|
expected: []byte("~\x00foo\x00"),
|
2022-06-29 20:34:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: Query{
|
|
|
|
Value: "foo",
|
|
|
|
PeerName: "*", // test wildcard PeerName
|
|
|
|
},
|
|
|
|
expected: []byte("peer:"),
|
|
|
|
},
|
|
|
|
},
|
2022-06-24 18:38:39 +00:00
|
|
|
extra: []indexerTestCase{
|
|
|
|
{
|
|
|
|
read: indexValue{
|
|
|
|
source: structs.PeeredServiceName{
|
|
|
|
ServiceName: structs.ServiceName{
|
|
|
|
Name: "foo",
|
|
|
|
},
|
|
|
|
Peer: "Billing",
|
|
|
|
},
|
2022-06-29 20:34:58 +00:00
|
|
|
expected: []byte("peer:billing\x00foo\x00"),
|
2022-06-24 18:38:39 +00:00
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: peeredObj,
|
2022-06-29 20:34:58 +00:00
|
|
|
expected: []byte("peer:billing\x00foo\x00"),
|
2022-06-24 18:38:39 +00:00
|
|
|
},
|
|
|
|
},
|
2021-12-02 23:42:47 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2021-12-02 00:44:13 +00:00
|
|
|
|
|
|
|
func testIndexerTableKindServiceNames() map[string]indexerTestCase {
|
|
|
|
obj := &KindServiceName{
|
|
|
|
Service: structs.ServiceName{
|
|
|
|
Name: "web-sidecar-proxy",
|
|
|
|
},
|
|
|
|
Kind: structs.ServiceKindConnectProxy,
|
|
|
|
}
|
|
|
|
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: &KindServiceName{
|
|
|
|
Service: structs.ServiceName{
|
|
|
|
Name: "web-sidecar-proxy",
|
|
|
|
},
|
|
|
|
Kind: structs.ServiceKindConnectProxy,
|
|
|
|
},
|
|
|
|
expected: []byte("connect-proxy\x00web-sidecar-proxy\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("connect-proxy\x00web-sidecar-proxy\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indexKind: {
|
|
|
|
read: indexValue{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
source: Query{Value: string(structs.ServiceKindConnectProxy)},
|
2021-12-02 00:44:13 +00:00
|
|
|
expected: []byte("connect-proxy\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: obj,
|
|
|
|
expected: []byte("connect-proxy\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|