state: add tests for checks indexers

This commit is contained in:
Daniel Nephin 2021-03-29 16:07:49 -04:00
parent 98d6dcbdf8
commit 9251ac881a
1 changed files with 29 additions and 3 deletions

View File

@ -8,9 +8,11 @@ import (
func testIndexerTableChecks() map[string]indexerTestCase {
obj := &structs.HealthCheck{
Node: "NoDe",
ServiceID: "SeRvIcE",
CheckID: "CheckID",
Node: "NoDe",
ServiceID: "SeRvIcE",
ServiceName: "ServiceName",
CheckID: "CheckID",
Status: "PASSING",
}
return map[string]indexerTestCase{
indexID: {
@ -36,6 +38,30 @@ func testIndexerTableChecks() map[string]indexerTestCase {
},
},
},
indexStatus: {
read: indexValue{
source: []interface{}{
"PASSING",
},
expected: []byte("PASSING\x00"),
},
write: indexValue{
source: obj,
expected: []byte("PASSING\x00"),
},
},
indexService: {
read: indexValue{
source: []interface{}{
"ServiceName",
},
expected: []byte("servicename\x00"),
},
write: indexValue{
source: obj,
expected: []byte("servicename\x00"),
},
},
indexNodeService: {
read: indexValue{
source: NodeServiceQuery{