From 9251ac881a78b000d0778177dfb60dd978d0d58c Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 29 Mar 2021 16:07:49 -0400 Subject: [PATCH] state: add tests for checks indexers --- agent/consul/state/catalog_oss_test.go | 32 +++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/agent/consul/state/catalog_oss_test.go b/agent/consul/state/catalog_oss_test.go index c33b12df9..50a50d049 100644 --- a/agent/consul/state/catalog_oss_test.go +++ b/agent/consul/state/catalog_oss_test.go @@ -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{