2021-02-19 19:38:07 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package state
|
|
|
|
|
|
|
|
import "github.com/hashicorp/consul/agent/structs"
|
|
|
|
|
|
|
|
func testIndexerTableChecks() map[string]indexerTestCase {
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexNodeService: {
|
|
|
|
read: indexValue{
|
|
|
|
source: NodeServiceQuery{
|
|
|
|
Node: "NoDe",
|
|
|
|
Service: "SeRvIcE",
|
|
|
|
},
|
|
|
|
expected: []byte("node\x00service\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.HealthCheck{
|
|
|
|
Node: "NoDe",
|
|
|
|
ServiceID: "SeRvIcE",
|
|
|
|
},
|
|
|
|
expected: []byte("node\x00service\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
indexNode: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{
|
|
|
|
Value: "NoDe",
|
|
|
|
},
|
|
|
|
expected: []byte("node\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.HealthCheck{
|
|
|
|
Node: "NoDe",
|
|
|
|
ServiceID: "SeRvIcE",
|
|
|
|
},
|
|
|
|
expected: []byte("node\x00"),
|
|
|
|
},
|
|
|
|
},
|
2021-02-19 19:38:07 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-19 23:18:25 +00:00
|
|
|
|
|
|
|
func testIndexerTableNodes() map[string]indexerTestCase {
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexID: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{Value: "NoDeId"},
|
|
|
|
expected: []byte("nodeid\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.Node{Node: "NoDeId"},
|
|
|
|
expected: []byte("nodeid\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2021-02-12 22:31:02 +00:00
|
|
|
|
|
|
|
func testIndexerTableServices() map[string]indexerTestCase {
|
|
|
|
return map[string]indexerTestCase{
|
|
|
|
indexNode: {
|
|
|
|
read: indexValue{
|
|
|
|
source: Query{
|
|
|
|
Value: "NoDe",
|
|
|
|
},
|
|
|
|
expected: []byte("node\x00"),
|
|
|
|
},
|
|
|
|
write: indexValue{
|
|
|
|
source: &structs.ServiceNode{
|
|
|
|
Node: "NoDe",
|
|
|
|
ServiceID: "SeRvIcE",
|
|
|
|
},
|
|
|
|
expected: []byte("node\x00"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|