state: add tests for checks indexers

pull/9949/head
Daniel Nephin 2021-03-29 16:07:49 -04:00
parent ce631d0bba
commit 628eed3748
1 changed files with 29 additions and 3 deletions

View File

@ -8,9 +8,11 @@ import (
func testIndexerTableChecks() map[string]indexerTestCase { func testIndexerTableChecks() map[string]indexerTestCase {
obj := &structs.HealthCheck{ obj := &structs.HealthCheck{
Node: "NoDe", Node: "NoDe",
ServiceID: "SeRvIcE", ServiceID: "SeRvIcE",
CheckID: "CheckID", ServiceName: "ServiceName",
CheckID: "CheckID",
Status: "PASSING",
} }
return map[string]indexerTestCase{ return map[string]indexerTestCase{
indexID: { 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: { indexNodeService: {
read: indexValue{ read: indexValue{
source: NodeServiceQuery{ source: NodeServiceQuery{