Skip to content
Snippets Groups Projects
Commit 2f4c7b86 authored by Pravein Govindan Kannan's avatar Pravein Govindan Kannan
Browse files

Fix linter and testing errors

parent 6a351f2b
Branches
No related tags found
No related merge requests found
...@@ -18,10 +18,10 @@ var ( ...@@ -18,10 +18,10 @@ var (
// fetchAgentIP guesses the non-loopback IP address of the Agent host, according to the // fetchAgentIP guesses the non-loopback IP address of the Agent host, according to the
// user-provided configuration: // user-provided configuration:
// - If AgentIP is provided, this value is used whatever is the real IP of the Agent. // - 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. // - 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 // - AgentIPType specifies which type of IP address should the agent pickup ("any" to pickup whichever
// ipv4 or ipv6 address is found first) // ipv4 or ipv6 address is found first)
func fetchAgentIP(cfg *Config) (net.IP, error) { func fetchAgentIP(cfg *Config) (net.IP, error) {
if cfg.AgentIP != "" { if cfg.AgentIP != "" {
if ip := net.ParseIP(cfg.AgentIP); ip != nil { if ip := net.ParseIP(cfg.AgentIP); ip != nil {
......
...@@ -50,9 +50,9 @@ func TestProtoConversion(t *testing.T) { ...@@ -50,9 +50,9 @@ func TestProtoConversion(t *testing.T) {
require.NoError(t, proto.Unmarshal(wc.messages[0].Value, &r)) require.NoError(t, proto.Unmarshal(wc.messages[0].Value, &r))
assert.EqualValues(t, 3, r.EthProtocol) assert.EqualValues(t, 3, r.EthProtocol)
assert.EqualValues(t, 1, r.Direction) assert.EqualValues(t, 1, r.Direction)
assert.EqualValues(t, 0xaabbccddeeff, r.DataLink.SrcMac) assert.EqualValues(t, uint64(0xaabbccddeeff), r.DataLink.SrcMac)
assert.EqualValues(t, 0x112233445566, r.DataLink.DstMac) assert.EqualValues(t, uint64(0x112233445566), r.DataLink.DstMac)
assert.EqualValues(t, 0xC0010203 /* 192.1.2.3 */, r.Network.SrcAddr.GetIpv4()) 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, 0x7F030201 /* 127.3.2.1 */, r.Network.DstAddr.GetIpv4())
assert.EqualValues(t, 4321, r.Transport.SrcPort) assert.EqualValues(t, 4321, r.Transport.SrcPort)
assert.EqualValues(t, 1234, r.Transport.DstPort) assert.EqualValues(t, 1234, r.Transport.DstPort)
......
...@@ -69,7 +69,7 @@ func TestGRPCCommunication(t *testing.T) { ...@@ -69,7 +69,7 @@ func TestGRPCCommunication(t *testing.T) {
assert.EqualValues(t, 456, r.Bytes) assert.EqualValues(t, 456, r.Bytes)
assert.EqualValues(t, 0x11223344, r.GetNetwork().GetSrcAddr().GetIpv4()) assert.EqualValues(t, 0x11223344, r.GetNetwork().GetSrcAddr().GetIpv4())
assert.EqualValues(t, 0x55667788, r.GetNetwork().GetDstAddr().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 { select {
case rs = <-serverOut: case rs = <-serverOut:
case <-time.After(timeout): case <-time.After(timeout):
...@@ -80,8 +80,8 @@ func TestGRPCCommunication(t *testing.T) { ...@@ -80,8 +80,8 @@ func TestGRPCCommunication(t *testing.T) {
assert.EqualValues(t, 789, r.EthProtocol) assert.EqualValues(t, 789, r.EthProtocol)
assert.EqualValues(t, 101, r.Bytes) assert.EqualValues(t, 101, r.Bytes)
assert.EqualValues(t, 0x44332211, r.GetNetwork().GetSrcAddr().GetIpv4()) assert.EqualValues(t, 0x44332211, r.GetNetwork().GetSrcAddr().GetIpv4())
assert.EqualValues(t, 0x88776655, r.GetNetwork().GetDstAddr().GetIpv4()) assert.EqualValues(t, uint64(0x88776655), r.GetNetwork().GetDstAddr().GetIpv4())
assert.EqualValues(t, 0xddccbbaa, r.GetAgentIp().GetIpv4()) assert.EqualValues(t, uint64(0xddccbbaa), r.GetAgentIp().GetIpv4())
select { select {
case rs = <-serverOut: case rs = <-serverOut:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment