fix tests

This commit is contained in:
Mika Savela 2023-01-12 11:34:15 +00:00
parent 1c7ace28c4
commit c939a03fb2

View File

@ -3,7 +3,6 @@ package ping
import (
"bytes"
"errors"
"fmt"
"net"
"runtime/debug"
"sync/atomic"
@ -26,7 +25,7 @@ func TestProcessPacket(t *testing.T) {
currentUUID := pinger.getCurrentTrackerUUID()
uuidEncoded, err := currentUUID.MarshalBinary()
if err != nil {
t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err))
t.Fatalf("unable to marshal UUID binary: %s", err)
}
data := append(timeToBytes(time.Now()), uuidEncoded...)
if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {
@ -69,7 +68,7 @@ func TestProcessPacket_IgnoreNonEchoReplies(t *testing.T) {
currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary()
if err != nil {
t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err))
t.Fatalf("unable to marshal UUID binary: %s", err)
}
data := append(timeToBytes(time.Now()), currentUUID...)
if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {
@ -112,7 +111,7 @@ func TestProcessPacket_IDMismatch(t *testing.T) {
currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary()
if err != nil {
t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err))
t.Fatalf("unable to marshal UUID binary: %s", err)
}
data := append(timeToBytes(time.Now()), currentUUID...)
if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {
@ -154,7 +153,7 @@ func TestProcessPacket_TrackerMismatch(t *testing.T) {
testUUID, err := uuid.New().MarshalBinary()
if err != nil {
t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err))
t.Fatalf("unable to marshal UUID binary: %s", err)
}
data := append(timeToBytes(time.Now()), testUUID...)
if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {
@ -192,7 +191,7 @@ func TestProcessPacket_LargePacket(t *testing.T) {
currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary()
if err != nil {
t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err))
t.Fatalf("unable to marshal UUID binary: %s", err)
}
data := append(timeToBytes(time.Now()), currentUUID...)
if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {
@ -545,7 +544,7 @@ func BenchmarkProcessPacket(b *testing.B) {
currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary()
if err != nil {
b.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err))
b.Fatalf("unable to marshal UUID binary: %s", err)
}
data := append(timeToBytes(time.Now()), currentUUID...)
if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {
@ -595,7 +594,7 @@ func TestProcessPacket_IgnoresDuplicateSequence(t *testing.T) {
currentUUID := pinger.getCurrentTrackerUUID()
uuidEncoded, err := currentUUID.MarshalBinary()
if err != nil {
t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err))
t.Fatalf("unable to marshal UUID binary: %s", err)
}
data := append(timeToBytes(time.Now()), uuidEncoded...)
if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {