mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
test/integration: use a context with a deadline for streaming
Without such a context, this test would hang without data for 10 minutes, then panic. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
This commit is contained in:
parent
a843239ec3
commit
ff8fbc2d37
@ -1972,6 +1972,10 @@ func TestTransform(t *testing.T) {
|
||||
rv = previousRV
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), wait.ForeverTestTimeout)
|
||||
t.Cleanup(func() {
|
||||
cancel()
|
||||
})
|
||||
w, err := client.Get().
|
||||
Resource(resource).NamespaceIfScoped(obj.GetNamespace(), len(obj.GetNamespace()) > 0).
|
||||
SetHeader("Accept", tc.accept).
|
||||
@ -1981,7 +1985,7 @@ func TestTransform(t *testing.T) {
|
||||
FieldSelector: fields.OneTermEqualSelector("metadata.name", obj.GetName()).String(),
|
||||
}, metav1.ParameterCodec).
|
||||
Param("includeObject", string(tc.includeObject)).
|
||||
Stream(context.TODO())
|
||||
Stream(ctx)
|
||||
if (tc.wantErr != nil) != (err != nil) {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user