From 2f4c7b8609e54a6a947edb2bd6c3b30f3b858c75 Mon Sep 17 00:00:00 2001 From: Pravein Govindan Kannan <pravein.govindan.kannan@ibm.com> Date: Tue, 10 Jan 2023 18:35:05 +0530 Subject: [PATCH] Fix linter and testing errors --- pkg/agent/ip.go | 8 ++++---- pkg/exporter/kafka_proto_test.go | 6 +++--- pkg/grpc/grpc_test.go | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/agent/ip.go b/pkg/agent/ip.go index c41c8640..b37a66fa 100644 --- a/pkg/agent/ip.go +++ b/pkg/agent/ip.go @@ -18,10 +18,10 @@ var ( // fetchAgentIP guesses the non-loopback IP address of the Agent host, according to the // user-provided configuration: -// - If AgentIP is provided, this value is used whatever is the real IP of the Agent. -// - AgentIPIface specifies which interface this function should look into in order to pickup an address. -// - AgentIPType specifies which type of IP address should the agent pickup ("any" to pickup whichever -// ipv4 or ipv6 address is found first) +// - If AgentIP is provided, this value is used whatever is the real IP of the Agent. +// - AgentIPIface specifies which interface this function should look into in order to pickup an address. +// - AgentIPType specifies which type of IP address should the agent pickup ("any" to pickup whichever +// ipv4 or ipv6 address is found first) func fetchAgentIP(cfg *Config) (net.IP, error) { if cfg.AgentIP != "" { if ip := net.ParseIP(cfg.AgentIP); ip != nil { diff --git a/pkg/exporter/kafka_proto_test.go b/pkg/exporter/kafka_proto_test.go index 91c53e32..0093df1b 100644 --- a/pkg/exporter/kafka_proto_test.go +++ b/pkg/exporter/kafka_proto_test.go @@ -50,9 +50,9 @@ func TestProtoConversion(t *testing.T) { require.NoError(t, proto.Unmarshal(wc.messages[0].Value, &r)) assert.EqualValues(t, 3, r.EthProtocol) assert.EqualValues(t, 1, r.Direction) - assert.EqualValues(t, 0xaabbccddeeff, r.DataLink.SrcMac) - assert.EqualValues(t, 0x112233445566, r.DataLink.DstMac) - assert.EqualValues(t, 0xC0010203 /* 192.1.2.3 */, r.Network.SrcAddr.GetIpv4()) + assert.EqualValues(t, uint64(0xaabbccddeeff), r.DataLink.SrcMac) + assert.EqualValues(t, uint64(0x112233445566), r.DataLink.DstMac) + assert.EqualValues(t, uint64(0xC0010203) /* 192.1.2.3 */, r.Network.SrcAddr.GetIpv4()) assert.EqualValues(t, 0x7F030201 /* 127.3.2.1 */, r.Network.DstAddr.GetIpv4()) assert.EqualValues(t, 4321, r.Transport.SrcPort) assert.EqualValues(t, 1234, r.Transport.DstPort) diff --git a/pkg/grpc/grpc_test.go b/pkg/grpc/grpc_test.go index fef4b349..eb2184ab 100644 --- a/pkg/grpc/grpc_test.go +++ b/pkg/grpc/grpc_test.go @@ -69,7 +69,7 @@ func TestGRPCCommunication(t *testing.T) { assert.EqualValues(t, 456, r.Bytes) assert.EqualValues(t, 0x11223344, r.GetNetwork().GetSrcAddr().GetIpv4()) assert.EqualValues(t, 0x55667788, r.GetNetwork().GetDstAddr().GetIpv4()) - assert.EqualValues(t, 0xaabbccdd, r.GetAgentIp().GetIpv4()) + assert.EqualValues(t, uint64(0xaabbccdd), r.GetAgentIp().GetIpv4()) select { case rs = <-serverOut: case <-time.After(timeout): @@ -80,8 +80,8 @@ func TestGRPCCommunication(t *testing.T) { assert.EqualValues(t, 789, r.EthProtocol) assert.EqualValues(t, 101, r.Bytes) assert.EqualValues(t, 0x44332211, r.GetNetwork().GetSrcAddr().GetIpv4()) - assert.EqualValues(t, 0x88776655, r.GetNetwork().GetDstAddr().GetIpv4()) - assert.EqualValues(t, 0xddccbbaa, r.GetAgentIp().GetIpv4()) + assert.EqualValues(t, uint64(0x88776655), r.GetNetwork().GetDstAddr().GetIpv4()) + assert.EqualValues(t, uint64(0xddccbbaa), r.GetAgentIp().GetIpv4()) select { case rs = <-serverOut: -- GitLab