diff options
author | Koren Lev <korenlev@gmail.com> | 2018-12-06 10:51:18 +0200 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-12-07 10:42:00 +0000 |
commit | f3b7a5e47af2dbb6a49b53fef56bc73e41cbf431 (patch) | |
tree | 108831a321547d6395084fa05677b1e54b148366 /extras/vpp_if_stats/vpp_if_stats_test.go | |
parent | 9f6957d1a5b23d4bee9390da20537db6e93b3433 (diff) |
vpp_if_stats: Fixing a bug in getting vpp interfaces indexes
Change-Id: I6290945a94b4f7878e9af94cc7daec455327482e
Signed-off-by: Koren Lev <korenlev@gmail.com>
Diffstat (limited to 'extras/vpp_if_stats/vpp_if_stats_test.go')
-rw-r--r--[-rwxr-xr-x] | extras/vpp_if_stats/vpp_if_stats_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/extras/vpp_if_stats/vpp_if_stats_test.go b/extras/vpp_if_stats/vpp_if_stats_test.go index 07a598364af..3c22ce85d75 100755..100644 --- a/extras/vpp_if_stats/vpp_if_stats_test.go +++ b/extras/vpp_if_stats/vpp_if_stats_test.go @@ -25,9 +25,9 @@ var ( Stats: interfaceStats{}, // TODO } } - testInterfaces = func() *map[uint32]*vppInterface { - return &map[uint32]*vppInterface{ - testSwIfIndex: testInterface(), + testInterfaces = func() []*vppInterface { + return []*vppInterface{ + testInterface(), } } @@ -164,7 +164,7 @@ func TestVppIfStats_GetStatsForAllInterfacesNoStats(t *testing.T) { mockStatsAPI := NewMockStatsAPI(mockCtrl) mockStatsAPI.EXPECT().DumpStats("/if").Return([]*adapter.StatEntry{}, nil) - v := vppConnector{stats: mockStatsAPI, Interfaces: *testInterfaces()} + v := vppConnector{stats: mockStatsAPI, Interfaces: testInterfaces()} err := v.getStatsForAllInterfaces() assert.NoError(t, err, "GetStatsForAllInterfaces should not return an error") assert.Equal(t, interfaceStats{}, v.Interfaces[testSwIfIndex].Stats, "Stats should be empty") @@ -177,7 +177,7 @@ func testStats(t *testing.T, statsDump *[]*adapter.StatEntry, expectedStats *int mockStatsAPI := NewMockStatsAPI(mockCtrl) mockStatsAPI.EXPECT().DumpStats("/if").Return(*statsDump, nil) - v := vppConnector{stats: mockStatsAPI, Interfaces: *testInterfaces()} + v := vppConnector{stats: mockStatsAPI, Interfaces: testInterfaces()} err := v.getStatsForAllInterfaces() assert.NoError(t, err, "GetStatsForAllInterfaces should not return an error") assert.Equal(t, *expectedStats, v.Interfaces[testSwIfIndex].Stats, "Collected and saved stats should match") |