mirror of
https://github.com/status-im/consul.git
synced 2025-01-20 18:50:04 +00:00
test: update tags for database service registrations and queries (#8693)
This commit is contained in:
parent
fb664c18dd
commit
dc50eca37f
@ -35,7 +35,7 @@ func TestCatalog_Register(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 8000,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -135,7 +135,7 @@ func TestCatalog_Register_NodeID(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 8000,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -199,7 +199,7 @@ node "foo" {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 8000,
|
||||
},
|
||||
WriteRequest: structs.WriteRequest{Token: id},
|
||||
@ -285,7 +285,7 @@ func TestCatalog_Register_ForwardLeader(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 8000,
|
||||
},
|
||||
}
|
||||
@ -318,7 +318,7 @@ func TestCatalog_Register_ForwardDC(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 8000,
|
||||
},
|
||||
}
|
||||
@ -1584,7 +1584,7 @@ func TestCatalog_ListServiceNodes(t *testing.T) {
|
||||
args := structs.ServiceSpecificRequest{
|
||||
Datacenter: "dc1",
|
||||
ServiceName: "db",
|
||||
ServiceTags: []string{"slave"},
|
||||
ServiceTags: []string{"replica"},
|
||||
TagFilter: false,
|
||||
}
|
||||
var out structs.IndexedServiceNodes
|
||||
|
@ -539,7 +539,7 @@ func TestHealth_ServiceNodes(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -559,7 +559,7 @@ func TestHealth_ServiceNodes(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"slave"},
|
||||
Tags: []string{"replica"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -575,7 +575,7 @@ func TestHealth_ServiceNodes(t *testing.T) {
|
||||
req := structs.ServiceSpecificRequest{
|
||||
Datacenter: "dc1",
|
||||
ServiceName: "db",
|
||||
ServiceTags: []string{"master"},
|
||||
ServiceTags: []string{"primary"},
|
||||
TagFilter: false,
|
||||
}
|
||||
if err := msgpackrpc.CallWithCodec(codec, "Health.ServiceNodes", &req, &out2); err != nil {
|
||||
@ -592,10 +592,10 @@ func TestHealth_ServiceNodes(t *testing.T) {
|
||||
if nodes[1].Node.Node != "foo" {
|
||||
t.Fatalf("Bad: %v", nodes[1])
|
||||
}
|
||||
if !stringslice.Contains(nodes[0].Service.Tags, "slave") {
|
||||
if !stringslice.Contains(nodes[0].Service.Tags, "replica") {
|
||||
t.Fatalf("Bad: %v", nodes[0])
|
||||
}
|
||||
if !stringslice.Contains(nodes[1].Service.Tags, "master") {
|
||||
if !stringslice.Contains(nodes[1].Service.Tags, "primary") {
|
||||
t.Fatalf("Bad: %v", nodes[1])
|
||||
}
|
||||
if nodes[0].Checks[0].Status != api.HealthWarning {
|
||||
@ -613,7 +613,7 @@ func TestHealth_ServiceNodes(t *testing.T) {
|
||||
req := structs.ServiceSpecificRequest{
|
||||
Datacenter: "dc1",
|
||||
ServiceName: "db",
|
||||
ServiceTag: "master",
|
||||
ServiceTag: "primary",
|
||||
TagFilter: false,
|
||||
}
|
||||
if err := msgpackrpc.CallWithCodec(codec, "Health.ServiceNodes", &req, &out2); err != nil {
|
||||
@ -630,10 +630,10 @@ func TestHealth_ServiceNodes(t *testing.T) {
|
||||
if nodes[1].Node.Node != "foo" {
|
||||
t.Fatalf("Bad: %v", nodes[1])
|
||||
}
|
||||
if !stringslice.Contains(nodes[0].Service.Tags, "slave") {
|
||||
if !stringslice.Contains(nodes[0].Service.Tags, "replica") {
|
||||
t.Fatalf("Bad: %v", nodes[0])
|
||||
}
|
||||
if !stringslice.Contains(nodes[1].Service.Tags, "master") {
|
||||
if !stringslice.Contains(nodes[1].Service.Tags, "primary") {
|
||||
t.Fatalf("Bad: %v", nodes[1])
|
||||
}
|
||||
if nodes[0].Checks[0].Status != api.HealthWarning {
|
||||
@ -662,7 +662,7 @@ func TestHealth_ServiceNodes_MultipleServiceTags(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"master", "v2"},
|
||||
Tags: []string{"primary", "v2"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -680,7 +680,7 @@ func TestHealth_ServiceNodes_MultipleServiceTags(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"slave", "v2"},
|
||||
Tags: []string{"replica", "v2"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -694,7 +694,7 @@ func TestHealth_ServiceNodes_MultipleServiceTags(t *testing.T) {
|
||||
req := structs.ServiceSpecificRequest{
|
||||
Datacenter: "dc1",
|
||||
ServiceName: "db",
|
||||
ServiceTags: []string{"master", "v2"},
|
||||
ServiceTags: []string{"primary", "v2"},
|
||||
TagFilter: true,
|
||||
}
|
||||
require.NoError(t, msgpackrpc.CallWithCodec(codec, "Health.ServiceNodes", &req, &out2))
|
||||
@ -703,7 +703,7 @@ func TestHealth_ServiceNodes_MultipleServiceTags(t *testing.T) {
|
||||
require.Len(t, nodes, 1)
|
||||
require.Equal(t, nodes[0].Node.Node, "foo")
|
||||
require.Contains(t, nodes[0].Service.Tags, "v2")
|
||||
require.Contains(t, nodes[0].Service.Tags, "master")
|
||||
require.Contains(t, nodes[0].Service.Tags, "primary")
|
||||
require.Equal(t, nodes[0].Checks[0].Status, api.HealthPassing)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func TestInternal_NodeInfo(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -63,7 +63,7 @@ func TestInternal_NodeInfo(t *testing.T) {
|
||||
if nodes[0].Node != "foo" {
|
||||
t.Fatalf("Bad: %v", nodes[0])
|
||||
}
|
||||
if !stringslice.Contains(nodes[0].Services[0].Tags, "master") {
|
||||
if !stringslice.Contains(nodes[0].Services[0].Tags, "primary") {
|
||||
t.Fatalf("Bad: %v", nodes[0])
|
||||
}
|
||||
if nodes[0].Checks[0].Status != api.HealthPassing {
|
||||
@ -88,7 +88,7 @@ func TestInternal_NodeDump(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -108,7 +108,7 @@ func TestInternal_NodeDump(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"slave"},
|
||||
Tags: []string{"replica"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -138,7 +138,7 @@ func TestInternal_NodeDump(t *testing.T) {
|
||||
switch node.Node {
|
||||
case "foo":
|
||||
foundFoo = true
|
||||
if !stringslice.Contains(node.Services[0].Tags, "master") {
|
||||
if !stringslice.Contains(node.Services[0].Tags, "primary") {
|
||||
t.Fatalf("Bad: %v", nodes[0])
|
||||
}
|
||||
if node.Checks[0].Status != api.HealthPassing {
|
||||
@ -147,7 +147,7 @@ func TestInternal_NodeDump(t *testing.T) {
|
||||
|
||||
case "bar":
|
||||
foundBar = true
|
||||
if !stringslice.Contains(node.Services[0].Tags, "slave") {
|
||||
if !stringslice.Contains(node.Services[0].Tags, "replica") {
|
||||
t.Fatalf("Bad: %v", nodes[1])
|
||||
}
|
||||
if node.Checks[0].Status != api.HealthWarning {
|
||||
@ -180,7 +180,7 @@ func TestInternal_NodeDump_Filter(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -198,7 +198,7 @@ func TestInternal_NodeDump_Filter(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db",
|
||||
Service: "db",
|
||||
Tags: []string{"slave"},
|
||||
Tags: []string{"replica"},
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
Name: "db connect",
|
||||
@ -212,7 +212,7 @@ func TestInternal_NodeDump_Filter(t *testing.T) {
|
||||
var out2 structs.IndexedNodeDump
|
||||
req := structs.DCSpecificRequest{
|
||||
Datacenter: "dc1",
|
||||
QueryOptions: structs.QueryOptions{Filter: "master in Services.Tags"},
|
||||
QueryOptions: structs.QueryOptions{Filter: "primary in Services.Tags"},
|
||||
}
|
||||
require.NoError(t, msgpackrpc.CallWithCodec(codec, "Internal.NodeDump", &req, &out2))
|
||||
|
||||
|
@ -204,7 +204,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
||||
Address: "1.1.1.1",
|
||||
Port: 8080,
|
||||
Meta: map[string]string{strings.Repeat("a", 129): "somevalue"},
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
}
|
||||
if err := s.EnsureRegistration(9, req); err == nil {
|
||||
t.Fatalf("Service should not have been registered since Meta is invalid")
|
||||
@ -216,7 +216,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
||||
Service: "redis",
|
||||
Address: "1.1.1.1",
|
||||
Port: 8080,
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Weights: &structs.Weights{Passing: 1, Warning: 1},
|
||||
}
|
||||
if err := s.EnsureRegistration(2, req); err != nil {
|
||||
@ -231,7 +231,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
||||
Service: "redis",
|
||||
Address: "1.1.1.1",
|
||||
Port: 8080,
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Weights: &structs.Weights{Passing: 1, Warning: 1},
|
||||
RaftIndex: structs.RaftIndex{CreateIndex: 2, ModifyIndex: 2},
|
||||
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||
@ -334,7 +334,7 @@ func TestStateStore_EnsureRegistration(t *testing.T) {
|
||||
Status: "critical",
|
||||
ServiceID: "redis1",
|
||||
ServiceName: "redis",
|
||||
ServiceTags: []string{"master"},
|
||||
ServiceTags: []string{"primary"},
|
||||
RaftIndex: structs.RaftIndex{CreateIndex: 4, ModifyIndex: 4},
|
||||
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||
},
|
||||
@ -1583,7 +1583,7 @@ func TestStateStore_Services(t *testing.T) {
|
||||
ns1 := &structs.NodeService{
|
||||
ID: "service1",
|
||||
Service: "redis",
|
||||
Tags: []string{"prod", "master"},
|
||||
Tags: []string{"prod", "primary"},
|
||||
Address: "1.1.1.1",
|
||||
Port: 1111,
|
||||
}
|
||||
@ -1595,7 +1595,7 @@ func TestStateStore_Services(t *testing.T) {
|
||||
ns2 := &structs.NodeService{
|
||||
ID: "service3",
|
||||
Service: "redis",
|
||||
Tags: []string{"prod", "slave"},
|
||||
Tags: []string{"prod", "replica"},
|
||||
Address: "1.1.1.1",
|
||||
Port: 1111,
|
||||
}
|
||||
@ -1619,7 +1619,7 @@ func TestStateStore_Services(t *testing.T) {
|
||||
// Verify the result. We sort the lists since the order is
|
||||
// non-deterministic (it's built using a map internally).
|
||||
expected := structs.Services{
|
||||
"redis": []string{"prod", "master", "slave"},
|
||||
"redis": []string{"prod", "primary", "replica"},
|
||||
"dogs": []string{},
|
||||
}
|
||||
sort.Strings(expected["redis"])
|
||||
@ -1663,7 +1663,7 @@ func TestStateStore_ServicesByNodeMeta(t *testing.T) {
|
||||
ns1 := &structs.NodeService{
|
||||
ID: "service1",
|
||||
Service: "redis",
|
||||
Tags: []string{"prod", "master"},
|
||||
Tags: []string{"prod", "primary"},
|
||||
Address: "1.1.1.1",
|
||||
Port: 1111,
|
||||
}
|
||||
@ -1673,7 +1673,7 @@ func TestStateStore_ServicesByNodeMeta(t *testing.T) {
|
||||
ns2 := &structs.NodeService{
|
||||
ID: "service1",
|
||||
Service: "redis",
|
||||
Tags: []string{"prod", "slave"},
|
||||
Tags: []string{"prod", "replica"},
|
||||
Address: "1.1.1.1",
|
||||
Port: 1111,
|
||||
}
|
||||
@ -1692,7 +1692,7 @@ func TestStateStore_ServicesByNodeMeta(t *testing.T) {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
expected := structs.Services{
|
||||
"redis": []string{"master", "prod"},
|
||||
"redis": []string{"primary", "prod"},
|
||||
}
|
||||
sort.Strings(res["redis"])
|
||||
require.Equal(t, expected, res)
|
||||
@ -1704,7 +1704,7 @@ func TestStateStore_ServicesByNodeMeta(t *testing.T) {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
expected := structs.Services{
|
||||
"redis": []string{"master", "prod", "slave"},
|
||||
"redis": []string{"primary", "prod", "replica"},
|
||||
}
|
||||
sort.Strings(res["redis"])
|
||||
require.Equal(t, expected, res)
|
||||
@ -1725,7 +1725,7 @@ func TestStateStore_ServicesByNodeMeta(t *testing.T) {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
expected := structs.Services{
|
||||
"redis": []string{"master", "prod"},
|
||||
"redis": []string{"primary", "prod"},
|
||||
}
|
||||
sort.Strings(res["redis"])
|
||||
require.Equal(t, expected, res)
|
||||
@ -1803,13 +1803,13 @@ func TestStateStore_ServiceNodes(t *testing.T) {
|
||||
if err := s.EnsureService(13, "bar", &structs.NodeService{ID: "api", Service: "api", Tags: nil, Address: "", Port: 5000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(14, "foo", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"master"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(14, "foo", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"primary"}, Address: "", Port: 8000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(15, "bar", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"slave"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(15, "bar", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"replica"}, Address: "", Port: 8000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(16, "bar", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"slave"}, Address: "", Port: 8001}); err != nil {
|
||||
if err := s.EnsureService(16, "bar", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"replica"}, Address: "", Port: 8001}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if !watchFired(ws) {
|
||||
@ -1837,7 +1837,7 @@ func TestStateStore_ServiceNodes(t *testing.T) {
|
||||
if nodes[0].ServiceID != "db" {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if !stringslice.Contains(nodes[0].ServiceTags, "slave") {
|
||||
if !stringslice.Contains(nodes[0].ServiceTags, "replica") {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if nodes[0].ServicePort != 8000 {
|
||||
@ -1852,7 +1852,7 @@ func TestStateStore_ServiceNodes(t *testing.T) {
|
||||
if nodes[1].ServiceID != "db2" {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if !stringslice.Contains(nodes[1].ServiceTags, "slave") {
|
||||
if !stringslice.Contains(nodes[1].ServiceTags, "replica") {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if nodes[1].ServicePort != 8001 {
|
||||
@ -1867,7 +1867,7 @@ func TestStateStore_ServiceNodes(t *testing.T) {
|
||||
if nodes[2].ServiceID != "db" {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if !stringslice.Contains(nodes[2].ServiceTags, "master") {
|
||||
if !stringslice.Contains(nodes[2].ServiceTags, "primary") {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if nodes[2].ServicePort != 8000 {
|
||||
@ -1922,7 +1922,7 @@ func TestStateStore_ServiceTagNodes(t *testing.T) {
|
||||
|
||||
// Listing with no results returns an empty list.
|
||||
ws := memdb.NewWatchSet()
|
||||
idx, nodes, err := s.ServiceTagNodes(ws, "db", []string{"master"}, nil)
|
||||
idx, nodes, err := s.ServiceTagNodes(ws, "db", []string{"primary"}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
@ -1940,13 +1940,13 @@ func TestStateStore_ServiceTagNodes(t *testing.T) {
|
||||
if err := s.EnsureNode(16, &structs.Node{Node: "bar", Address: "127.0.0.2"}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(17, "foo", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"master"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(17, "foo", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"primary"}, Address: "", Port: 8000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(18, "foo", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"slave"}, Address: "", Port: 8001}); err != nil {
|
||||
if err := s.EnsureService(18, "foo", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"replica"}, Address: "", Port: 8001}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(19, "bar", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"slave"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(19, "bar", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"replica"}, Address: "", Port: 8000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if !watchFired(ws) {
|
||||
@ -1955,7 +1955,7 @@ func TestStateStore_ServiceTagNodes(t *testing.T) {
|
||||
|
||||
// Read everything back.
|
||||
ws = memdb.NewWatchSet()
|
||||
idx, nodes, err = s.ServiceTagNodes(ws, "db", []string{"master"}, nil)
|
||||
idx, nodes, err = s.ServiceTagNodes(ws, "db", []string{"primary"}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
@ -1971,7 +1971,7 @@ func TestStateStore_ServiceTagNodes(t *testing.T) {
|
||||
if nodes[0].Address != "127.0.0.1" {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if !stringslice.Contains(nodes[0].ServiceTags, "master") {
|
||||
if !stringslice.Contains(nodes[0].ServiceTags, "primary") {
|
||||
t.Fatalf("bad: %v", nodes)
|
||||
}
|
||||
if nodes[0].ServicePort != 8000 {
|
||||
@ -1984,7 +1984,7 @@ func TestStateStore_ServiceTagNodes(t *testing.T) {
|
||||
t.Fatalf("bad")
|
||||
}
|
||||
|
||||
// But removing a node with the "db:master" service should fire the watch.
|
||||
// But removing a node with the "db:primary" service should fire the watch.
|
||||
if err := s.DeleteNode(21, "foo"); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
@ -2004,25 +2004,25 @@ func TestStateStore_ServiceTagNodes_MultipleTags(t *testing.T) {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
if err := s.EnsureService(17, "foo", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"master", "v2"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(17, "foo", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"primary", "v2"}, Address: "", Port: 8000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
if err := s.EnsureService(18, "foo", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"slave", "v2", "dev"}, Address: "", Port: 8001}); err != nil {
|
||||
if err := s.EnsureService(18, "foo", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"replica", "v2", "dev"}, Address: "", Port: 8001}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
if err := s.EnsureService(19, "bar", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"slave", "v2"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(19, "bar", &structs.NodeService{ID: "db", Service: "db", Tags: []string{"replica", "v2"}, Address: "", Port: 8000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
idx, nodes, err := s.ServiceTagNodes(nil, "db", []string{"master"}, nil)
|
||||
idx, nodes, err := s.ServiceTagNodes(nil, "db", []string{"primary"}, nil)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int(idx), 19)
|
||||
require.Len(t, nodes, 1)
|
||||
require.Equal(t, nodes[0].Node, "foo")
|
||||
require.Equal(t, nodes[0].Address, "127.0.0.1")
|
||||
require.Contains(t, nodes[0].ServiceTags, "master")
|
||||
require.Contains(t, nodes[0].ServiceTags, "primary")
|
||||
require.Equal(t, nodes[0].ServicePort, 8000)
|
||||
|
||||
idx, nodes, err = s.ServiceTagNodes(nil, "db", []string{"v2"}, nil)
|
||||
@ -2031,14 +2031,14 @@ func TestStateStore_ServiceTagNodes_MultipleTags(t *testing.T) {
|
||||
require.Len(t, nodes, 3)
|
||||
|
||||
// Test filtering on multiple tags
|
||||
idx, nodes, err = s.ServiceTagNodes(nil, "db", []string{"v2", "slave"}, nil)
|
||||
idx, nodes, err = s.ServiceTagNodes(nil, "db", []string{"v2", "replica"}, nil)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int(idx), 19)
|
||||
require.Len(t, nodes, 2)
|
||||
require.Contains(t, nodes[0].ServiceTags, "v2")
|
||||
require.Contains(t, nodes[0].ServiceTags, "slave")
|
||||
require.Contains(t, nodes[0].ServiceTags, "replica")
|
||||
require.Contains(t, nodes[1].ServiceTags, "v2")
|
||||
require.Contains(t, nodes[1].ServiceTags, "slave")
|
||||
require.Contains(t, nodes[1].ServiceTags, "replica")
|
||||
|
||||
idx, nodes, err = s.ServiceTagNodes(nil, "db", []string{"dev"}, nil)
|
||||
require.NoError(t, err)
|
||||
@ -2125,7 +2125,7 @@ func TestStateStore_ConnectServiceNodes(t *testing.T) {
|
||||
assert.Nil(s.EnsureService(14, "foo", &structs.NodeService{Kind: structs.ServiceKindConnectProxy, ID: "proxy", Service: "proxy", Proxy: structs.ConnectProxyConfig{DestinationServiceName: "db"}, Port: 8000}))
|
||||
assert.Nil(s.EnsureService(15, "bar", &structs.NodeService{Kind: structs.ServiceKindConnectProxy, ID: "proxy", Service: "proxy", Proxy: structs.ConnectProxyConfig{DestinationServiceName: "db"}, Port: 8000}))
|
||||
assert.Nil(s.EnsureService(16, "bar", &structs.NodeService{ID: "native-db", Service: "db", Connect: structs.ServiceConnect{Native: true}}))
|
||||
assert.Nil(s.EnsureService(17, "bar", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"slave"}, Address: "", Port: 8001}))
|
||||
assert.Nil(s.EnsureService(17, "bar", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"replica"}, Address: "", Port: 8001}))
|
||||
assert.True(watchFired(ws))
|
||||
|
||||
// Read everything back.
|
||||
@ -3575,7 +3575,7 @@ func TestStateStore_CheckConnectServiceNodes(t *testing.T) {
|
||||
assert.Nil(s.EnsureService(13, "bar", &structs.NodeService{ID: "api", Service: "api", Tags: nil, Address: "", Port: 5000}))
|
||||
assert.Nil(s.EnsureService(14, "foo", &structs.NodeService{Kind: structs.ServiceKindConnectProxy, ID: "proxy", Service: "proxy", Proxy: structs.ConnectProxyConfig{DestinationServiceName: "db"}, Port: 8000}))
|
||||
assert.Nil(s.EnsureService(15, "bar", &structs.NodeService{Kind: structs.ServiceKindConnectProxy, ID: "proxy", Service: "proxy", Proxy: structs.ConnectProxyConfig{DestinationServiceName: "db"}, Port: 8000}))
|
||||
assert.Nil(s.EnsureService(16, "bar", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"slave"}, Address: "", Port: 8001}))
|
||||
assert.Nil(s.EnsureService(16, "bar", &structs.NodeService{ID: "db2", Service: "db", Tags: []string{"replica"}, Address: "", Port: 8001}))
|
||||
assert.True(watchFired(ws))
|
||||
|
||||
// Register node checks
|
||||
@ -3731,7 +3731,7 @@ func BenchmarkCheckServiceNodes(b *testing.B) {
|
||||
if err := s.EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}); err != nil {
|
||||
b.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(2, "foo", &structs.NodeService{ID: "db1", Service: "db", Tags: []string{"master"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(2, "foo", &structs.NodeService{ID: "db1", Service: "db", Tags: []string{"primary"}, Address: "", Port: 8000}); err != nil {
|
||||
b.Fatalf("err: %v", err)
|
||||
}
|
||||
check := &structs.HealthCheck{
|
||||
@ -3766,7 +3766,7 @@ func TestStateStore_CheckServiceTagNodes(t *testing.T) {
|
||||
if err := s.EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := s.EnsureService(2, "foo", &structs.NodeService{ID: "db1", Service: "db", Tags: []string{"master"}, Address: "", Port: 8000}); err != nil {
|
||||
if err := s.EnsureService(2, "foo", &structs.NodeService{ID: "db1", Service: "db", Tags: []string{"primary"}, Address: "", Port: 8000}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
check := &structs.HealthCheck{
|
||||
@ -3790,7 +3790,7 @@ func TestStateStore_CheckServiceTagNodes(t *testing.T) {
|
||||
}
|
||||
|
||||
ws := memdb.NewWatchSet()
|
||||
idx, nodes, err := s.CheckServiceTagNodes(ws, "db", []string{"master"}, nil)
|
||||
idx, nodes, err := s.CheckServiceTagNodes(ws, "db", []string{"primary"}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ func TestDNS_EDNS0_ECS(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -1014,7 +1014,7 @@ func TestDNS_ServiceReverseLookup(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
Address: "127.0.0.2",
|
||||
},
|
||||
@ -1062,7 +1062,7 @@ func TestDNS_ServiceReverseLookup_IPV6(t *testing.T) {
|
||||
Address: "2001:db8::1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
Address: "2001:db8::ff00:42:8329",
|
||||
},
|
||||
@ -1112,7 +1112,7 @@ func TestDNS_ServiceReverseLookup_CustomDomain(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
Address: "127.0.0.2",
|
||||
},
|
||||
@ -1193,7 +1193,7 @@ func TestDNS_ServiceReverseLookupNodeAddress(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
Address: "127.0.0.1",
|
||||
},
|
||||
@ -1428,7 +1428,7 @@ func TestDNS_ServiceLookup(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -2165,7 +2165,7 @@ func TestDNS_ServiceLookup_ServiceAddress_A(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Address: "127.0.0.2",
|
||||
Port: 12345,
|
||||
},
|
||||
@ -2268,7 +2268,7 @@ func TestDNS_ServiceLookup_ServiceAddress_SRV(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Address: "www.google.com",
|
||||
Port: 12345,
|
||||
},
|
||||
@ -2365,7 +2365,7 @@ func TestDNS_ServiceLookup_ServiceAddressIPV6(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Address: "2607:20:4005:808::200e",
|
||||
Port: 12345,
|
||||
},
|
||||
@ -2856,7 +2856,7 @@ func TestDNS_CaseInsensitiveServiceLookup(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "Db",
|
||||
Tags: []string{"Master"},
|
||||
Tags: []string{"Primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -2887,9 +2887,9 @@ func TestDNS_CaseInsensitiveServiceLookup(t *testing.T) {
|
||||
|
||||
// Try some variations to make sure case doesn't matter.
|
||||
questions := []string{
|
||||
"master.db.service.consul.",
|
||||
"mASTER.dB.service.consul.",
|
||||
"MASTER.dB.service.consul.",
|
||||
"primary.db.service.consul.",
|
||||
"pRIMARY.dB.service.consul.",
|
||||
"PRIMARY.dB.service.consul.",
|
||||
"db.service.consul.",
|
||||
"DB.service.consul.",
|
||||
"Db.service.consul.",
|
||||
@ -2926,7 +2926,7 @@ func TestDNS_ServiceLookup_TagPeriod(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"v1.master"},
|
||||
Tags: []string{"v1.primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -2937,7 +2937,7 @@ func TestDNS_ServiceLookup_TagPeriod(t *testing.T) {
|
||||
}
|
||||
|
||||
m1 := new(dns.Msg)
|
||||
m1.SetQuestion("v1.master2.db.service.consul.", dns.TypeSRV)
|
||||
m1.SetQuestion("v1.primary2.db.service.consul.", dns.TypeSRV)
|
||||
|
||||
c1 := new(dns.Client)
|
||||
in, _, err := c1.Exchange(m1, a.DNSAddr())
|
||||
@ -2950,7 +2950,7 @@ func TestDNS_ServiceLookup_TagPeriod(t *testing.T) {
|
||||
}
|
||||
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("v1.master.db.service.consul.", dns.TypeSRV)
|
||||
m.SetQuestion("v1.primary.db.service.consul.", dns.TypeSRV)
|
||||
|
||||
c := new(dns.Client)
|
||||
in, _, err = c.Exchange(m, a.DNSAddr())
|
||||
@ -3321,7 +3321,7 @@ func TestDNS_ServiceLookup_Dedup(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -3338,7 +3338,7 @@ func TestDNS_ServiceLookup_Dedup(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db2",
|
||||
Service: "db",
|
||||
Tags: []string{"slave"},
|
||||
Tags: []string{"replica"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -3353,7 +3353,7 @@ func TestDNS_ServiceLookup_Dedup(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db3",
|
||||
Service: "db",
|
||||
Tags: []string{"slave"},
|
||||
Tags: []string{"replica"},
|
||||
Port: 12346,
|
||||
},
|
||||
}
|
||||
@ -3424,7 +3424,7 @@ func TestDNS_ServiceLookup_Dedup_SRV(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -3441,7 +3441,7 @@ func TestDNS_ServiceLookup_Dedup_SRV(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db2",
|
||||
Service: "db",
|
||||
Tags: []string{"slave"},
|
||||
Tags: []string{"replica"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -3456,7 +3456,7 @@ func TestDNS_ServiceLookup_Dedup_SRV(t *testing.T) {
|
||||
Service: &structs.NodeService{
|
||||
ID: "db3",
|
||||
Service: "db",
|
||||
Tags: []string{"slave"},
|
||||
Tags: []string{"replica"},
|
||||
Port: 12346,
|
||||
},
|
||||
}
|
||||
@ -3672,7 +3672,7 @@ func TestDNS_ServiceLookup_FilterCritical(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3693,7 +3693,7 @@ func TestDNS_ServiceLookup_FilterCritical(t *testing.T) {
|
||||
Address: "127.0.0.2",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3712,7 +3712,7 @@ func TestDNS_ServiceLookup_FilterCritical(t *testing.T) {
|
||||
Address: "127.0.0.2",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3732,7 +3732,7 @@ func TestDNS_ServiceLookup_FilterCritical(t *testing.T) {
|
||||
Address: "127.0.0.3",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -3746,7 +3746,7 @@ func TestDNS_ServiceLookup_FilterCritical(t *testing.T) {
|
||||
Address: "127.0.0.4",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3828,7 +3828,7 @@ func TestDNS_ServiceLookup_OnlyFailing(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3849,7 +3849,7 @@ func TestDNS_ServiceLookup_OnlyFailing(t *testing.T) {
|
||||
Address: "127.0.0.2",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3868,7 +3868,7 @@ func TestDNS_ServiceLookup_OnlyFailing(t *testing.T) {
|
||||
Address: "127.0.0.2",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3945,7 +3945,7 @@ func TestDNS_ServiceLookup_OnlyPassing(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3967,7 +3967,7 @@ func TestDNS_ServiceLookup_OnlyPassing(t *testing.T) {
|
||||
Address: "127.0.0.2",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -3988,7 +3988,7 @@ func TestDNS_ServiceLookup_OnlyPassing(t *testing.T) {
|
||||
Address: "127.0.0.3",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
@ -4395,7 +4395,7 @@ func TestDNS_ServiceLookup_LargeResponses(t *testing.T) {
|
||||
Address: fmt.Sprintf("127.0.0.%d", i+1),
|
||||
Service: &structs.NodeService{
|
||||
Service: longServiceName,
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -4415,7 +4415,7 @@ func TestDNS_ServiceLookup_LargeResponses(t *testing.T) {
|
||||
Name: longServiceName,
|
||||
Service: structs.ServiceQuery{
|
||||
Service: longServiceName,
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -4427,7 +4427,7 @@ func TestDNS_ServiceLookup_LargeResponses(t *testing.T) {
|
||||
|
||||
// Look up the service directly and via prepared query.
|
||||
questions := []string{
|
||||
"_" + longServiceName + "._master.service.consul.",
|
||||
"_" + longServiceName + "._primary.service.consul.",
|
||||
longServiceName + ".query.consul.",
|
||||
}
|
||||
for _, question := range questions {
|
||||
@ -5141,7 +5141,7 @@ func TestDNS_ServiceLookup_TTL(t *testing.T) {
|
||||
Address: address,
|
||||
Service: &structs.NodeService{
|
||||
Service: service,
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345 + idx,
|
||||
},
|
||||
}
|
||||
@ -5220,7 +5220,7 @@ func TestDNS_PreparedQuery_TTL(t *testing.T) {
|
||||
Address: address,
|
||||
Service: &structs.NodeService{
|
||||
Service: service,
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345 + idx,
|
||||
},
|
||||
}
|
||||
@ -5439,7 +5439,7 @@ func TestDNS_ServiceLookup_SRV_RFC(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -5450,10 +5450,10 @@ func TestDNS_ServiceLookup_SRV_RFC(t *testing.T) {
|
||||
}
|
||||
|
||||
questions := []string{
|
||||
"_db._master.service.dc1.consul.",
|
||||
"_db._master.service.consul.",
|
||||
"_db._master.dc1.consul.",
|
||||
"_db._master.consul.",
|
||||
"_db._primary.service.dc1.consul.",
|
||||
"_db._primary.service.consul.",
|
||||
"_db._primary.dc1.consul.",
|
||||
"_db._primary.consul.",
|
||||
}
|
||||
|
||||
for _, question := range questions {
|
||||
@ -5514,7 +5514,7 @@ func TestDNS_ServiceLookup_SRV_RFC_TCP_Default(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -5642,7 +5642,7 @@ func TestDNS_ServiceLookup_MetaTXT(t *testing.T) {
|
||||
},
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -5689,7 +5689,7 @@ func TestDNS_ServiceLookup_SuppressTXT(t *testing.T) {
|
||||
},
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -6036,7 +6036,7 @@ func TestDNS_AltDomains_Service(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
@ -6790,7 +6790,7 @@ func TestDNS_Compression_Query(t *testing.T) {
|
||||
Address: "127.0.0.1",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tags: []string{"master"},
|
||||
Tags: []string{"primary"},
|
||||
Port: 12345,
|
||||
},
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func TestShouldProcessUserEvent(t *testing.T) {
|
||||
srv1 := &structs.NodeService{
|
||||
ID: "mysql",
|
||||
Service: "mysql",
|
||||
Tags: []string{"test", "foo", "bar", "master"},
|
||||
Tags: []string{"test", "foo", "bar", "primary"},
|
||||
Port: 5000,
|
||||
}
|
||||
a.State.AddService(srv1, "")
|
||||
@ -99,7 +99,7 @@ func TestShouldProcessUserEvent(t *testing.T) {
|
||||
// Bad tag name
|
||||
p = &UserEvent{
|
||||
ServiceFilter: ".*sql",
|
||||
TagFilter: "slave",
|
||||
TagFilter: "replica",
|
||||
}
|
||||
if a.shouldProcessUserEvent(p) {
|
||||
t.Fatalf("bad")
|
||||
@ -108,7 +108,7 @@ func TestShouldProcessUserEvent(t *testing.T) {
|
||||
// Good service name
|
||||
p = &UserEvent{
|
||||
ServiceFilter: ".*sql",
|
||||
TagFilter: "master",
|
||||
TagFilter: "primary",
|
||||
}
|
||||
if !a.shouldProcessUserEvent(p) {
|
||||
t.Fatalf("bad")
|
||||
@ -154,7 +154,7 @@ func TestFireReceiveEvent(t *testing.T) {
|
||||
srv1 := &structs.NodeService{
|
||||
ID: "mysql",
|
||||
Service: "mysql",
|
||||
Tags: []string{"test", "foo", "bar", "master"},
|
||||
Tags: []string{"test", "foo", "bar", "primary"},
|
||||
Port: 5000,
|
||||
}
|
||||
a.State.AddService(srv1, "")
|
||||
|
Loading…
x
Reference in New Issue
Block a user