Skip to content

Commit

Permalink
Merge pull request #18514 from juanvallejo/jvallejo/handle-watch-mult…
Browse files Browse the repository at this point in the history
…iple-reqs

Automatic merge from submit-queue.

UPSTREAM: 59506: fix watch on multiple reqs

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1537789

`oc get <resource> --watch` only supports watching a single resource kind at a time.
This check fails if more than one resource `Info` is returned.

When dealing with large quantities of a single resource kind, or an amount that exceeds the value of `--chunk-size`, more than one request is made to the server causing a resource `Info` to be created for each of the requests, ultimately causing the above check to fail even though we are dealing with the same type of resource.

This patch modifies that check to take into account the GVKs of all infos returned, and only fail if at least one differs.

cc @deads2k @jeremyeder
  • Loading branch information
openshift-merge-robot authored Feb 12, 2018
2 parents fd83080 + 170d39f commit 48d2a6d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 6 additions & 0 deletions test/cmd/get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@ os::cmd::expect_success_and_not_text 'oc get users test-user-1' "customlabel=tru
# test structured and unstructured resources print generically without panic
os::cmd::expect_success_and_text 'oc get projectrequests -o yaml' 'status: Success'
os::cmd::expect_success_and_text 'oc get projectrequests,svc,pod -o yaml' 'kind: List'
# test --wacth does not result in an error when a resource list is served in multiple chunks
os::cmd::expect_success 'oc create cm cmone'
os::cmd::expect_success 'oc create cm cmtwo'
os::cmd::expect_success 'oc create cm cmthree'
os::cmd::expect_success_and_not_text 'oc get configmap --chunk-size=1 --watch --request-timeout=1s' 'watch is only supported on individual resources'
os::cmd::expect_success_and_not_text 'oc get configmap --chunk-size=1 --watch-only --request-timeout=1s' 'watch is only supported on individual resources'
echo "oc get: ok"
os::test::junit::declare_suite_end
22 changes: 19 additions & 3 deletions vendor/k8s.io/kubernetes/pkg/kubectl/cmd/resource/get.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 48d2a6d

Please sign in to comment.