|
|
@ -2997,8 +2997,8 @@ func testDNSServiceLookupResponseLimits(t *testing.T, answerLimit int, qType uin
|
|
|
|
return true, nil
|
|
|
|
return true, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func testDNSServiceLookupResponseARecordLimits(t *testing.T, generateNumNodes int, aRecordLimit int, qType uint16,
|
|
|
|
func checkDNSService(t *testing.T, generateNumNodes int, aRecordLimit int, qType uint16,
|
|
|
|
expectedResultsCount int, udpSize uint16, udpAnswerLimit int) (bool, error) {
|
|
|
|
expectedResultsCount int, udpSize uint16, udpAnswerLimit int) error {
|
|
|
|
a := NewTestAgent(t.Name(), `
|
|
|
|
a := NewTestAgent(t.Name(), `
|
|
|
|
node_name = "test-node"
|
|
|
|
node_name = "test-node"
|
|
|
|
dns_config {
|
|
|
|
dns_config {
|
|
|
@ -3025,7 +3025,7 @@ func testDNSServiceLookupResponseARecordLimits(t *testing.T, generateNumNodes in
|
|
|
|
|
|
|
|
|
|
|
|
var out struct{}
|
|
|
|
var out struct{}
|
|
|
|
if err := a.RPC("Catalog.Register", args, &out); err != nil {
|
|
|
|
if err := a.RPC("Catalog.Register", args, &out); err != nil {
|
|
|
|
return false, fmt.Errorf("err: %v", err)
|
|
|
|
return fmt.Errorf("err: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var id string
|
|
|
|
var id string
|
|
|
@ -3042,7 +3042,7 @@ func testDNSServiceLookupResponseARecordLimits(t *testing.T, generateNumNodes in
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if err := a.RPC("PreparedQuery.Apply", args, &id); err != nil {
|
|
|
|
if err := a.RPC("PreparedQuery.Apply", args, &id); err != nil {
|
|
|
|
return false, fmt.Errorf("err: %v", err)
|
|
|
|
return fmt.Errorf("err: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3066,14 +3066,14 @@ func testDNSServiceLookupResponseARecordLimits(t *testing.T, generateNumNodes in
|
|
|
|
c := &dns.Client{Net: protocol, UDPSize: 8192}
|
|
|
|
c := &dns.Client{Net: protocol, UDPSize: 8192}
|
|
|
|
in, _, err := c.Exchange(m, a.DNSAddr())
|
|
|
|
in, _, err := c.Exchange(m, a.DNSAddr())
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return false, fmt.Errorf("err: %v", err)
|
|
|
|
return fmt.Errorf("err: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(in.Answer) != expectedResultsCount {
|
|
|
|
if len(in.Answer) != expectedResultsCount {
|
|
|
|
return false, fmt.Errorf("%d/%d answers received for type %v for %s (%s)", len(in.Answer), expectedResultsCount, qType, question, protocol)
|
|
|
|
return fmt.Errorf("%d/%d answers received for type %v for %s (%s)", len(in.Answer), expectedResultsCount, qType, question, protocol)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestDNS_ServiceLookup_ARecordLimits(t *testing.T) {
|
|
|
|
func TestDNS_ServiceLookup_ARecordLimits(t *testing.T) {
|
|
|
@ -3137,8 +3137,8 @@ func TestDNS_ServiceLookup_ARecordLimits(t *testing.T) {
|
|
|
|
for idx, qType := range queriesLimited {
|
|
|
|
for idx, qType := range queriesLimited {
|
|
|
|
t.Run(fmt.Sprintf("ARecordLimit %d qType: %d", idx, qType), func(t *testing.T) {
|
|
|
|
t.Run(fmt.Sprintf("ARecordLimit %d qType: %d", idx, qType), func(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
t.Parallel()
|
|
|
|
ok, err := testDNSServiceLookupResponseARecordLimits(t, test.numNodesTotal, test.aRecordLimit, qType, test.expectedAResults, test.udpSize, test.udpAnswerLimit)
|
|
|
|
err := checkDNSService(t, test.numNodesTotal, test.aRecordLimit, qType, test.expectedAResults, test.udpSize, test.udpAnswerLimit)
|
|
|
|
if !ok {
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("Expected lookup %s to pass: %v", test.name, err)
|
|
|
|
t.Errorf("Expected lookup %s to pass: %v", test.name, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -3146,8 +3146,8 @@ func TestDNS_ServiceLookup_ARecordLimits(t *testing.T) {
|
|
|
|
// No limits but the size of records for SRV records, since not subject to randomization issues
|
|
|
|
// No limits but the size of records for SRV records, since not subject to randomization issues
|
|
|
|
t.Run("SRV lookup limitARecord", func(t *testing.T) {
|
|
|
|
t.Run("SRV lookup limitARecord", func(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
t.Parallel()
|
|
|
|
ok, err := testDNSServiceLookupResponseARecordLimits(t, test.expectedSRVResults, test.aRecordLimit, dns.TypeSRV, test.numNodesTotal, test.udpSize, test.udpAnswerLimit)
|
|
|
|
err := checkDNSService(t, test.expectedSRVResults, test.aRecordLimit, dns.TypeSRV, test.numNodesTotal, test.udpSize, test.udpAnswerLimit)
|
|
|
|
if !ok {
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("Expected service SRV lookup %s to pass: %v", test.name, err)
|
|
|
|
t.Errorf("Expected service SRV lookup %s to pass: %v", test.name, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|