X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvpp_if_stats%2Fvpp_if_stats_test.go;h=3c22ce85d7547b0a757c53fa60b812a871313db0;hb=f3b7a5e47af2dbb6a49b53fef56bc73e41cbf431;hp=07a598364af6dede2016e6c7e97491a4d2f1985d;hpb=9f6957d1a5b23d4bee9390da20537db6e93b3433;p=vpp.git diff --git a/extras/vpp_if_stats/vpp_if_stats_test.go b/extras/vpp_if_stats/vpp_if_stats_test.go old mode 100755 new mode 100644 index 07a598364af..3c22ce85d75 --- 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")