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 {
|
func testIndexerTableNodes() map[string]indexerTestCase {
|
||||||
return map[string]indexerTestCase{
|
return map[string]indexerTestCase{
|
||||||
indexID: {
|
indexID: {
|
||||||
|
|
|
@ -132,6 +132,7 @@ func TestNewDBSchema_Indexers(t *testing.T) {
|
||||||
tableServices: testIndexerTableServices,
|
tableServices: testIndexerTableServices,
|
||||||
tableNodes: testIndexerTableNodes,
|
tableNodes: testIndexerTableNodes,
|
||||||
tableConfigEntries: testIndexerTableConfigEntries,
|
tableConfigEntries: testIndexerTableConfigEntries,
|
||||||
|
tableMeshTopology: testIndexerTableMeshTopology,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, table := range schema.Tables {
|
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.
|
// UpstreamDownstream pairs come from individual proxy registrations, which can be updated independently.
|
||||||
|
// TODO: move to state package
|
||||||
type UpstreamDownstream struct {
|
type UpstreamDownstream struct {
|
||||||
Upstream ServiceName
|
Upstream ServiceName
|
||||||
Downstream ServiceName
|
Downstream ServiceName
|
||||||
|
|
Loading…
Reference in New Issue