mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Add tracing to GetContainerStats
This commit is contained in:
parent
2cfc85c8b3
commit
cd8d8f2dce
@ -77,6 +77,7 @@ type FakeDockerClient struct {
|
||||
execCmd []string
|
||||
EnableSleep bool
|
||||
ImageHistoryMap map[string][]dockerimagetypes.HistoryResponseItem
|
||||
ContainerStatsMap map[string]*dockertypes.StatsJSON
|
||||
}
|
||||
|
||||
const (
|
||||
@ -913,9 +914,19 @@ func (f *FakeDockerPuller) GetImageRef(image string) (string, error) {
|
||||
return image, err
|
||||
}
|
||||
|
||||
func (f *FakeDockerClient) InjectContainerStats(data map[string]*dockertypes.StatsJSON) {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
f.ContainerStatsMap = data
|
||||
}
|
||||
|
||||
func (f *FakeDockerClient) GetContainerStats(id string) (*dockertypes.StatsJSON, error) {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
f.appendCalled(CalledDetail{name: "getContainerStats"})
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
f.appendCalled(CalledDetail{name: "get_container_stats"})
|
||||
stats, ok := f.ContainerStatsMap[id]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("container %q not found", id)
|
||||
}
|
||||
return stats, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user