@@ -39,9 +39,24 @@ type fakeNetworkStatsProvider struct {
39
39
containers []containerStats
40
40
}
41
41
42
+ // NetworkStats holds the network statistics for a container
43
+ type fakeNetworkStats struct {
44
+ BytesReceived uint64
45
+ BytesSent uint64
46
+ PacketsReceived uint64
47
+ PacketsSent uint64
48
+ DroppedPacketsIncoming uint64
49
+ DroppedPacketsOutgoing uint64
50
+ EndpointId string
51
+ InstanceId string
52
+ }
53
+
54
+ type fakeContainerProperties struct {
55
+ ID string
56
+ }
42
57
type containerStats struct {
43
- container hcsshim. ContainerProperties
44
- hcsStats []hcsshim. NetworkStats
58
+ container fakeContainerProperties
59
+ hcsStats []fakeNetworkStats
45
60
}
46
61
47
62
func (s fakeNetworkStatsProvider ) GetHNSEndpointStats (endpointName string ) (* hcsshim.HNSEndpointStats , error ) {
@@ -105,9 +120,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
105
120
fields : fakeNetworkStatsProvider {
106
121
containers : []containerStats {
107
122
{
108
- container : hcsshim. ContainerProperties {
123
+ container : fakeContainerProperties {
109
124
ID : "c1" ,
110
- }, hcsStats : []hcsshim. NetworkStats {
125
+ }, hcsStats : []fakeNetworkStats {
111
126
{
112
127
BytesReceived : 1 ,
113
128
BytesSent : 10 ,
@@ -117,9 +132,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
117
132
},
118
133
},
119
134
{
120
- container : hcsshim. ContainerProperties {
135
+ container : fakeContainerProperties {
121
136
ID : "c2" ,
122
- }, hcsStats : []hcsshim. NetworkStats {
137
+ }, hcsStats : []fakeNetworkStats {
123
138
{
124
139
BytesReceived : 2 ,
125
140
BytesSent : 20 ,
@@ -170,9 +185,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
170
185
fields : fakeNetworkStatsProvider {
171
186
containers : []containerStats {
172
187
{
173
- container : hcsshim. ContainerProperties {
188
+ container : fakeContainerProperties {
174
189
ID : "c1" ,
175
- }, hcsStats : []hcsshim. NetworkStats {
190
+ }, hcsStats : []fakeNetworkStats {
176
191
{
177
192
BytesReceived : 1 ,
178
193
BytesSent : 10 ,
@@ -182,9 +197,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
182
197
},
183
198
},
184
199
{
185
- container : hcsshim. ContainerProperties {
200
+ container : fakeContainerProperties {
186
201
ID : "c2" ,
187
- }, hcsStats : []hcsshim. NetworkStats {
202
+ }, hcsStats : []fakeNetworkStats {
188
203
{
189
204
BytesReceived : 2 ,
190
205
BytesSent : 20 ,
@@ -194,9 +209,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
194
209
},
195
210
},
196
211
{
197
- container : hcsshim. ContainerProperties {
212
+ container : fakeContainerProperties {
198
213
ID : "c3" ,
199
- }, hcsStats : []hcsshim. NetworkStats {
214
+ }, hcsStats : []fakeNetworkStats {
200
215
{
201
216
BytesReceived : 3 ,
202
217
BytesSent : 30 ,
@@ -262,9 +277,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
262
277
fields : fakeNetworkStatsProvider {
263
278
containers : []containerStats {
264
279
{
265
- container : hcsshim. ContainerProperties {
280
+ container : fakeContainerProperties {
266
281
ID : "c1" ,
267
- }, hcsStats : []hcsshim. NetworkStats {
282
+ }, hcsStats : []fakeNetworkStats {
268
283
{
269
284
BytesReceived : 1 ,
270
285
BytesSent : 10 ,
@@ -280,9 +295,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
280
295
},
281
296
},
282
297
{
283
- container : hcsshim. ContainerProperties {
298
+ container : fakeContainerProperties {
284
299
ID : "c2" ,
285
- }, hcsStats : []hcsshim. NetworkStats {
300
+ }, hcsStats : []fakeNetworkStats {
286
301
{
287
302
BytesReceived : 2 ,
288
303
BytesSent : 20 ,
@@ -333,9 +348,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
333
348
fields : fakeNetworkStatsProvider {
334
349
containers : []containerStats {
335
350
{
336
- container : hcsshim. ContainerProperties {
351
+ container : fakeContainerProperties {
337
352
ID : "c1" ,
338
- }, hcsStats : []hcsshim. NetworkStats {
353
+ }, hcsStats : []fakeNetworkStats {
339
354
{
340
355
BytesReceived : 1 ,
341
356
BytesSent : 10 ,
@@ -351,9 +366,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
351
366
},
352
367
},
353
368
{
354
- container : hcsshim. ContainerProperties {
369
+ container : fakeContainerProperties {
355
370
ID : "c2" ,
356
- }, hcsStats : []hcsshim. NetworkStats {
371
+ }, hcsStats : []fakeNetworkStats {
357
372
{
358
373
BytesReceived : 2 ,
359
374
BytesSent : 20 ,
0 commit comments