Merge pull request #7569 from zhangguanzhang/fix-apiv2-top-response-two-value

fix APIv2 pods top of non-exist pod gets two response value
This commit is contained in:
OpenShift Merge Robot 2020-09-09 09:12:40 -04:00 committed by GitHub
commit 1b2b068ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

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
}

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"