fix APIv2 pods top of non-exist pod gets two response value

Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
This commit is contained in:
zhangguanzhang committed 2020-09-09 18:50:17 +08:00
1 parent 3352e8b0e6
commit a4ffed91da
2 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -327,7 +327,7 @@ func PodTop(w http.ResponseWriter, r *http.Request) {
name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.ContainerNotFound(w, name, err)
utils.PodNotFound(w, name, err)
return
}
+4
View File
@@ -102,6 +102,10 @@ t GET libpod/pods/stats?namesOrIDs=fakename 404 \
t DELETE libpod/pods/bar?force=true 200
# test the fake name
t GET libpod/pods/fakename/top 404 \
.cause="no such pod"
t GET libpod/pods/foo/top 200 \
.Processes[0][-1]="/pause " \
.Titles[-1]="COMMAND"