diff --git a/README.md b/README.md index 0cd4fed7..d9eedb33 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@
- + - +
diff --git a/dnsutils/helper.go b/dnsutils/helper.go index 522d9477..4e0ef55a 100644 --- a/dnsutils/helper.go +++ b/dnsutils/helper.go @@ -16,7 +16,7 @@ func GetFakeDNS() ([]byte, error) { return dnsmsg.Pack() } -func GetDnsResponsePacket() ([]byte, error) { +func GetDNSResponsePacket() ([]byte, error) { dnsmsg := new(dns.Msg) dnsmsg.SetQuestion("dns.collector.", dns.TypeA) diff --git a/workers/dnsprocessor_test.go b/workers/dnsprocessor_test.go index 53d9c73a..e91c111a 100644 --- a/workers/dnsprocessor_test.go +++ b/workers/dnsprocessor_test.go @@ -10,7 +10,6 @@ import ( "github.com/dmachard/go-dnscollector/dnsutils" "github.com/dmachard/go-dnscollector/pkgconfig" "github.com/dmachard/go-logger" - "github.com/dmachard/go-netutils" ) func Test_DnsProcessor(t *testing.T) { @@ -50,12 +49,10 @@ func Test_DnsProcessor_DecodeCounters(t *testing.T) { go consumer.StartCollect() // get dns packet - responsePacket, _ := dnsutils.GetDnsResponsePacket() + responsePacket, _ := dnsutils.GetDNSResponsePacket() // prepare dns message dm := dnsutils.GetFakeDNSMessage() - dm.NetworkInfo.Family = netutils.ProtoIPv4 - dm.NetworkInfo.Protocol = netutils.ProtoUDP dm.DNS.Payload = responsePacket dm.DNS.Length = len(responsePacket) @@ -65,16 +62,16 @@ func Test_DnsProcessor_DecodeCounters(t *testing.T) { // read dns message from dnstap consumer dmOut := <-fl.GetInputChannel() if dmOut.DNS.QdCount != 1 { - t.Errorf("invalid number of questions in dns message: %d", dmOut.DNS.QdCount) + t.Errorf("invalid number of questions in dns message: got %d expect 1", dmOut.DNS.QdCount) } if dmOut.DNS.NsCount != 1 { - t.Errorf("invalid number of nscount in dns message: %d", dmOut.DNS.NsCount) + t.Errorf("invalid number of nscount in dns message: got %d expect 1", dmOut.DNS.NsCount) } if dmOut.DNS.AnCount != 1 { - t.Errorf("invalid number of ancount in dns message: %d", dmOut.DNS.AnCount) + t.Errorf("invalid number of ancount in dns message: got %d expect 1", dmOut.DNS.AnCount) } if dmOut.DNS.ArCount != 1 { - t.Errorf("invalid number of arcount in dns message: %d", dmOut.DNS.ArCount) + t.Errorf("invalid number of arcount in dns message: got %d expect 1", dmOut.DNS.ArCount) } } diff --git a/workers/dnstapserver_test.go b/workers/dnstapserver_test.go index 2bb1273f..74c6ad70 100644 --- a/workers/dnstapserver_test.go +++ b/workers/dnstapserver_test.go @@ -254,7 +254,7 @@ func Test_DnstapProcessor_DecodeCounters(t *testing.T) { consumer.AddDroppedRoute(fl) // get dns packet - responsePacket, _ := dnsutils.GetDnsResponsePacket() + responsePacket, _ := dnsutils.GetDNSResponsePacket() // prepare dnstap dt := &dnstap.Dnstap{} @@ -274,16 +274,16 @@ func Test_DnstapProcessor_DecodeCounters(t *testing.T) { // read dns message from dnstap consumer dm := <-fl.GetInputChannel() if dm.DNS.QdCount != 1 { - t.Errorf("invalid number of questions in dns message: %d", dm.DNS.QdCount) + t.Errorf("invalid number of questions in dns message: got %d expect 1", dm.DNS.QdCount) } if dm.DNS.NsCount != 1 { - t.Errorf("invalid number of nscount in dns message: %d", dm.DNS.NsCount) + t.Errorf("invalid number of nscount in dns message: got %d expect 1", dm.DNS.NsCount) } if dm.DNS.AnCount != 1 { - t.Errorf("invalid number of ancount in dns message: %d", dm.DNS.AnCount) + t.Errorf("invalid number of ancount in dns message: got %d expect 1", dm.DNS.AnCount) } if dm.DNS.ArCount != 1 { - t.Errorf("invalid number of arcount in dns message: %d", dm.DNS.ArCount) + t.Errorf("invalid number of arcount in dns message: got %d expect 1", dm.DNS.ArCount) } }