Unverified Commit 89542d9e authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #61154 from hanxiaoshuai/bugfix0314

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. catch err when Watch testResource failed in func TestWatchCallNonNamespace **What this PR does / why we need it**: catch err when Watch testResource failed in func TestWatchCallNonNamespace **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # [#61155](https://github.com/kubernetes/kubernetes/issues/61155) **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents b976ebd5 c63e22ee
......@@ -63,6 +63,9 @@ func TestWatchCallNonNamespace(t *testing.T) {
codecs := serializer.NewCodecFactory(scheme)
o := NewObjectTracker(scheme, codecs.UniversalDecoder())
watch, err := o.Watch(testResource, ns)
if err != nil {
t.Fatalf("test resource watch failed in %s: %v ", ns, err)
}
go func() {
err := o.Create(testResource, testObj, ns)
if err != nil {
......@@ -85,7 +88,13 @@ func TestWatchCallAllNamespace(t *testing.T) {
codecs := serializer.NewCodecFactory(scheme)
o := NewObjectTracker(scheme, codecs.UniversalDecoder())
w, err := o.Watch(testResource, "test_namespace")
if err != nil {
t.Fatalf("test resource watch failed in test_namespace: %v", err)
}
wAll, err := o.Watch(testResource, "")
if err != nil {
t.Fatalf("test resource watch failed in all namespaces: %v", err)
}
go func() {
err := o.Create(testResource, testObj, ns)
assert.NoError(t, err, "test resource creation failed")
......@@ -161,6 +170,9 @@ func TestWatchCallMultipleInvocation(t *testing.T) {
for idx, watchNamespace := range watchNamespaces {
i := idx
w, err := o.Watch(testResource, watchNamespace)
if err != nil {
t.Fatalf("test resource watch failed in %s: %v", watchNamespace, err)
}
go func() {
assert.NoError(t, err, "watch invocation failed")
for _, c := range cases {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment