summaryrefslogtreecommitdiffhomepage
path: root/test/packetimpact
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-01-12 12:36:17 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-12 12:38:22 -0800
commit4e03e87547853523d4ff941935a6ef1712518c61 (patch)
treee930ce0e5f15f7041e7b74daca05acc7afbd2558 /test/packetimpact
parenta20da708291e2e5bdece5176dce61c1b4b10b7d9 (diff)
Fix simple mistakes identified by goreportcard.
These are primarily simplification and lint mistakes. However, minor fixes are also included and tests added where appropriate. PiperOrigin-RevId: 351425971
Diffstat (limited to 'test/packetimpact')
-rw-r--r--test/packetimpact/netdevs/netdevs_test.go12
-rw-r--r--test/packetimpact/tests/udp_icmp_error_propagation_test.go8
2 files changed, 10 insertions, 10 deletions
diff --git a/test/packetimpact/netdevs/netdevs_test.go b/test/packetimpact/netdevs/netdevs_test.go
index 24ad12198..379386980 100644
--- a/test/packetimpact/netdevs/netdevs_test.go
+++ b/test/packetimpact/netdevs/netdevs_test.go
@@ -63,7 +63,7 @@ func TestParseDevices(t *testing.T) {
inet6 fe80::42:daff:fe33:130a/64 scope link tentative
valid_lft forever preferred_lft forever`,
want: map[string]DeviceInfo{
- "lo": DeviceInfo{
+ "lo": {
ID: 1,
MAC: mustParseMAC("00:00:00:00:00:00"),
IPv4Addr: net.IPv4(127, 0, 0, 1),
@@ -77,7 +77,7 @@ func TestParseDevices(t *testing.T) {
Mask: net.CIDRMask(128, 128),
},
},
- "eth0": DeviceInfo{
+ "eth0": {
ID: 2613,
MAC: mustParseMAC("02:42:c0:a8:09:02"),
IPv4Addr: net.IPv4(192, 168, 9, 2),
@@ -91,7 +91,7 @@ func TestParseDevices(t *testing.T) {
Mask: net.CIDRMask(64, 128),
},
},
- "eth1": DeviceInfo{
+ "eth1": {
ID: 2617,
MAC: mustParseMAC("02:42:da:33:13:0a"),
IPv4Addr: net.IPv4(218, 51, 19, 10),
@@ -105,7 +105,7 @@ func TestParseDevices(t *testing.T) {
Mask: net.CIDRMask(64, 128),
},
},
- "eth2": DeviceInfo{
+ "eth2": {
ID: 2615,
MAC: mustParseMAC("02:42:df:f5:e1:0a"),
IPv4Addr: net.IPv4(223, 245, 225, 10),
@@ -129,7 +129,7 @@ func TestParseDevices(t *testing.T) {
inet 192.168.9.2/24 brd 192.168.9.255 scope global eth0
valid_lft forever preferred_lft forever`,
want: map[string]DeviceInfo{
- "eth0": DeviceInfo{
+ "eth0": {
ID: 2613,
MAC: mustParseMAC("02:42:c0:a8:09:02"),
IPv4Addr: net.IPv4(192, 168, 9, 2),
@@ -148,7 +148,7 @@ func TestParseDevices(t *testing.T) {
inet6 fe80::42:dfff:fef5:e10a/64 scope link tentative
valid_lft forever preferred_lft forever`,
want: map[string]DeviceInfo{
- "eth2": DeviceInfo{
+ "eth2": {
ID: 2615,
MAC: mustParseMAC("02:42:df:f5:e1:0a"),
IPv6Addr: net.ParseIP("fe80::42:dfff:fef5:e10a"),
diff --git a/test/packetimpact/tests/udp_icmp_error_propagation_test.go b/test/packetimpact/tests/udp_icmp_error_propagation_test.go
index cd4523e88..58d49d31a 100644
--- a/test/packetimpact/tests/udp_icmp_error_propagation_test.go
+++ b/test/packetimpact/tests/udp_icmp_error_propagation_test.go
@@ -220,12 +220,12 @@ func TestUDPICMPErrorPropagation(t *testing.T) {
wantErrno := wantErrno(connect, icmpErr)
for _, errDetect := range []errorDetection{
- errorDetection{"SendTo", false, testSendTo},
+ {"SendTo", false, testSendTo},
// Send to an address that's different from the one that caused an ICMP
// error to be returned.
- errorDetection{"SendToValid", true, testSendTo},
- errorDetection{"Recv", false, testRecv},
- errorDetection{"SockOpt", false, testSockOpt},
+ {"SendToValid", true, testSendTo},
+ {"Recv", false, testRecv},
+ {"SockOpt", false, testSockOpt},
} {
t.Run(fmt.Sprintf("%s/%s/%s", connect, icmpErr, errDetect.name), func(t *testing.T) {
dut := testbench.NewDUT(t)