mirror of https://github.com/status-im/consul.git
state: add tests for mesh-topology table indexers
This commit is contained in:
parent
c749c6c927
commit
65f5b99247
|
@ -40,6 +40,51 @@ func testIndexerTableChecks() map[string]indexerTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
func testIndexerTableMeshTopology() map[string]indexerTestCase {
|
||||
obj := structs.UpstreamDownstream{
|
||||
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{
|
||||
source: structs.ServiceName{Name: "UpStReAm"},
|
||||
|
||||
expected: []byte("upstream\x00"),
|
||||
},
|
||||
write: indexValue{
|
||||
source: obj,
|
||||
expected: []byte("upstream\x00"),
|
||||
},
|
||||
},
|
||||
indexDownstream: {
|
||||
read: indexValue{
|
||||
source: structs.ServiceName{Name: "DownStream"},
|
||||
|
||||
expected: []byte("downstream\x00"),
|
||||
},
|
||||
write: indexValue{
|
||||
source: obj,
|
||||
expected: []byte("downstream\x00"),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func testIndexerTableNodes() map[string]indexerTestCase {
|
||||
return map[string]indexerTestCase{
|
||||
indexID: {
|
||||
|
|
|
@ -132,6 +132,7 @@ func TestNewDBSchema_Indexers(t *testing.T) {
|
|||
tableServices: testIndexerTableServices,
|
||||
tableNodes: testIndexerTableNodes,
|
||||
tableConfigEntries: testIndexerTableConfigEntries,
|
||||
tableMeshTopology: testIndexerTableMeshTopology,
|
||||
}
|
||||
|
||||
for _, table := range schema.Tables {
|
||||
|
|
|
@ -2476,6 +2476,7 @@ func (m MessageType) String() string {
|
|||
}
|
||||
|
||||
// UpstreamDownstream pairs come from individual proxy registrations, which can be updated independently.
|
||||
// TODO: move to state package
|
||||
type UpstreamDownstream struct {
|
||||
Upstream ServiceName
|
||||
Downstream ServiceName
|
||||
|
|
Loading…
Reference in New Issue