mirror of https://github.com/status-im/consul.git
agent: Fixing bug in dns service filtering
This commit is contained in:
parent
fad3e4d97c
commit
76ec9d22b1
|
@ -384,6 +384,7 @@ func (d *DNSServer) filterServiceNodes(nodes structs.CheckServiceNodes) structs.
|
|||
node.Node.Node, check.CheckID, check.Name, node.Service.Service)
|
||||
nodes[i], nodes[n-1] = nodes[n-1], structs.CheckServiceNode{}
|
||||
n--
|
||||
i--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ func TestDNS_ServiceLookup_FilterCritical(t *testing.T) {
|
|||
// Wait for leader
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
// Register node
|
||||
// Register nodes
|
||||
args := &structs.RegisterRequest{
|
||||
Datacenter: "dc1",
|
||||
Node: "foo",
|
||||
|
@ -353,6 +353,25 @@ func TestDNS_ServiceLookup_FilterCritical(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
args2 := &structs.RegisterRequest{
|
||||
Datacenter: "dc1",
|
||||
Node: "bar",
|
||||
Address: "127.0.0.2",
|
||||
Service: &structs.NodeService{
|
||||
Service: "db",
|
||||
Tag: "master",
|
||||
Port: 12345,
|
||||
},
|
||||
Check: &structs.HealthCheck{
|
||||
CheckID: "serf",
|
||||
Name: "serf",
|
||||
Status: structs.HealthCritical,
|
||||
},
|
||||
}
|
||||
if err := srv.agent.RPC("Catalog.Register", args2, &out); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("db.service.consul.", dns.TypeANY)
|
||||
|
||||
|
|
Loading…
Reference in New Issue