mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Merge pull request #127644 from kiashok/refactor-hcs-references
Add local reference to hcs structs in windows cri stats test
This commit is contained in:
commit
a83e295270
@ -39,9 +39,24 @@ type fakeNetworkStatsProvider struct {
|
|||||||
containers []containerStats
|
containers []containerStats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkStats holds the network statistics for a container
|
||||||
|
type fakeNetworkStats struct {
|
||||||
|
BytesReceived uint64
|
||||||
|
BytesSent uint64
|
||||||
|
PacketsReceived uint64
|
||||||
|
PacketsSent uint64
|
||||||
|
DroppedPacketsIncoming uint64
|
||||||
|
DroppedPacketsOutgoing uint64
|
||||||
|
EndpointId string
|
||||||
|
InstanceId string
|
||||||
|
}
|
||||||
|
|
||||||
|
type fakeContainerProperties struct {
|
||||||
|
ID string
|
||||||
|
}
|
||||||
type containerStats struct {
|
type containerStats struct {
|
||||||
container hcsshim.ContainerProperties
|
container fakeContainerProperties
|
||||||
hcsStats []hcsshim.NetworkStats
|
hcsStats []fakeNetworkStats
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s fakeNetworkStatsProvider) GetHNSEndpointStats(endpointName string) (*hcsshim.HNSEndpointStats, error) {
|
func (s fakeNetworkStatsProvider) GetHNSEndpointStats(endpointName string) (*hcsshim.HNSEndpointStats, error) {
|
||||||
@ -105,9 +120,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
fields: fakeNetworkStatsProvider{
|
fields: fakeNetworkStatsProvider{
|
||||||
containers: []containerStats{
|
containers: []containerStats{
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c1",
|
ID: "c1",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 1,
|
BytesReceived: 1,
|
||||||
BytesSent: 10,
|
BytesSent: 10,
|
||||||
@ -117,9 +132,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c2",
|
ID: "c2",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 2,
|
BytesReceived: 2,
|
||||||
BytesSent: 20,
|
BytesSent: 20,
|
||||||
@ -170,9 +185,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
fields: fakeNetworkStatsProvider{
|
fields: fakeNetworkStatsProvider{
|
||||||
containers: []containerStats{
|
containers: []containerStats{
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c1",
|
ID: "c1",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 1,
|
BytesReceived: 1,
|
||||||
BytesSent: 10,
|
BytesSent: 10,
|
||||||
@ -182,9 +197,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c2",
|
ID: "c2",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 2,
|
BytesReceived: 2,
|
||||||
BytesSent: 20,
|
BytesSent: 20,
|
||||||
@ -194,9 +209,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c3",
|
ID: "c3",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 3,
|
BytesReceived: 3,
|
||||||
BytesSent: 30,
|
BytesSent: 30,
|
||||||
@ -262,9 +277,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
fields: fakeNetworkStatsProvider{
|
fields: fakeNetworkStatsProvider{
|
||||||
containers: []containerStats{
|
containers: []containerStats{
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c1",
|
ID: "c1",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 1,
|
BytesReceived: 1,
|
||||||
BytesSent: 10,
|
BytesSent: 10,
|
||||||
@ -280,9 +295,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c2",
|
ID: "c2",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 2,
|
BytesReceived: 2,
|
||||||
BytesSent: 20,
|
BytesSent: 20,
|
||||||
@ -333,9 +348,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
fields: fakeNetworkStatsProvider{
|
fields: fakeNetworkStatsProvider{
|
||||||
containers: []containerStats{
|
containers: []containerStats{
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c1",
|
ID: "c1",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 1,
|
BytesReceived: 1,
|
||||||
BytesSent: 10,
|
BytesSent: 10,
|
||||||
@ -351,9 +366,9 @@ func Test_criStatsProvider_listContainerNetworkStats(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
container: hcsshim.ContainerProperties{
|
container: fakeContainerProperties{
|
||||||
ID: "c2",
|
ID: "c2",
|
||||||
}, hcsStats: []hcsshim.NetworkStats{
|
}, hcsStats: []fakeNetworkStats{
|
||||||
{
|
{
|
||||||
BytesReceived: 2,
|
BytesReceived: 2,
|
||||||
BytesSent: 20,
|
BytesSent: 20,
|
||||||
|
Loading…
Reference in New Issue
Block a user