Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use context.Context in API methods #1274

Merged
merged 48 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
dcc8344
Refactor: add ctx param to KnServingClient funs
matejvasek Mar 23, 2021
6ea7a35
Passing ctx from knServingClient to ServingV1Interface
matejvasek Mar 23, 2021
c1096ca
Making wait function cancellable
matejvasek Mar 23, 2021
fc8127f
Test using background ctx
matejvasek Mar 23, 2021
57437b7
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 23, 2021
9598646
Handling SIGINT and SIGTERM
matejvasek Mar 23, 2021
aa37491
Refactor: add ctx param to KnEventingClient funs
matejvasek Mar 24, 2021
fd47321
Passing ctx from knServingClient to knative.dev interfaces
matejvasek Mar 24, 2021
627d16e
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
2dbdcd4
Test using background ctx
matejvasek Mar 24, 2021
88da32f
fixup style
matejvasek Mar 24, 2021
df5bc54
Removing unnecessary dependency
matejvasek Mar 24, 2021
568e23f
Refactor: add ctx param to KnChannelsClient funs
matejvasek Mar 24, 2021
8d1dc55
Passing ctx from knServingClient to knative.dev interfaces
matejvasek Mar 24, 2021
3de1e94
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
d3bd128
Refactor: add ctx param to KnSubscriptionsClient funs
matejvasek Mar 24, 2021
188d27b
Passing ctx from subscriptionsClient to knative.dev interfaces
matejvasek Mar 24, 2021
600e970
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
9c8beaa
Refactor: add ctx param to KnSinkBindingClient funs
matejvasek Mar 24, 2021
2e365a5
Passing ctx from knBindingClient to knative.dev interfaces
matejvasek Mar 24, 2021
8919d3c
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
c101a24
Test using background ctx
matejvasek Mar 24, 2021
93fddef
Refactor: add ctx param to KnDynamicClient funs
matejvasek Mar 24, 2021
d8726fc
Passing ctx from knDynamicClient to knative.dev interfaces
matejvasek Mar 24, 2021
e6b2cc6
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
109b237
Test using background ctx
matejvasek Mar 24, 2021
bb7adfe
Refactor: add ctx param to KnAPIServerSourcesClient funs
matejvasek Mar 24, 2021
392c48c
Passing ctx from APIServerSourcesRecorder to knative.dev interfaces
matejvasek Mar 24, 2021
ceb5379
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
e88e329
Test using background ctx
matejvasek Mar 24, 2021
2d639be
Refactor: add ctx param to KnContainerSourcesClient funs
matejvasek Mar 24, 2021
a291290
Passing ctx from containerSourcesClient to knative.dev interfaces
matejvasek Mar 24, 2021
5981d1f
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
13a8ffc
Test using background ctx
matejvasek Mar 24, 2021
7259ecc
Refactor: add ctx param to KnPingSourcesClient funs
matejvasek Mar 24, 2021
9c9dc58
Passing ctx from pingSourcesClient to knative.dev interfaces
matejvasek Mar 24, 2021
7f23944
Using cmd.Context() in pkg/kn/commands
matejvasek Mar 24, 2021
efe36f7
Test using background ctx
matejvasek Mar 24, 2021
2408ebe
Removing ctx param from RawClient()
matejvasek Mar 24, 2021
dc5adc5
ctx for watch/polling
matejvasek Mar 24, 2021
c4c703c
fix per review request
matejvasek Mar 24, 2021
46bf2ba
Refactor: extract ctx
matejvasek Mar 26, 2021
1f9e157
Refactor: Namespace not requiring ctx
matejvasek Mar 26, 2021
1b11149
fixup
matejvasek Mar 26, 2021
d77d2c9
Revert "Handling SIGINT and SIGTERM"
matejvasek Mar 26, 2021
51bffb1
Update CHANGELOG
matejvasek Mar 26, 2021
9217c05
Add test for Wait()
matejvasek Mar 26, 2021
8a367f2
Add test for Wait()
matejvasek Mar 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
| 🎁
| Add S column to specify built-in sources in kn source list-types
| https://github.com/knative/client/pull/1246[#1246]

| 🎁
| Add context.Context parameter to API function
| https://github.com/knative/client/pull/1274[#1274]
|===

## v0.21.0 (2021-02-23)
Expand Down
38 changes: 19 additions & 19 deletions pkg/dynamic/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ type KnDynamicClient interface {
Namespace() string

// ListCRDs returns list of CRDs with their type and name
ListCRDs(options metav1.ListOptions) (*unstructured.UnstructuredList, error)
ListCRDs(ctx context.Context, options metav1.ListOptions) (*unstructured.UnstructuredList, error)

// ListSourcesTypes returns list of eventing sources CRDs
ListSourcesTypes() (*unstructured.UnstructuredList, error)
ListSourcesTypes(ctx context.Context) (*unstructured.UnstructuredList, error)

// ListSources returns list of available source objects
ListSources(types ...WithType) (*unstructured.UnstructuredList, error)
ListSources(ctx context.Context, types ...WithType) (*unstructured.UnstructuredList, error)

// ListSourcesUsingGVKs returns list of available source objects using given list of GVKs
ListSourcesUsingGVKs(*[]schema.GroupVersionKind, ...WithType) (*unstructured.UnstructuredList, error)
ListSourcesUsingGVKs(context.Context, *[]schema.GroupVersionKind, ...WithType) (*unstructured.UnstructuredList, error)

// ListChannelsTypes returns installed knative channel CRDs
ListChannelsTypes() (*unstructured.UnstructuredList, error)
ListChannelsTypes(ctx context.Context) (*unstructured.UnstructuredList, error)

// ListChannelsUsingGVKs returns list of available channel objects using given list of GVKs
ListChannelsUsingGVKs(*[]schema.GroupVersionKind, ...WithType) (*unstructured.UnstructuredList, error)
ListChannelsUsingGVKs(context.Context, *[]schema.GroupVersionKind, ...WithType) (*unstructured.UnstructuredList, error)

// RawClient returns the raw dynamic client interface
RawClient() dynamic.Interface
Expand All @@ -94,14 +94,14 @@ func (c *knDynamicClient) Namespace() string {

// TODO(navidshaikh): Use ListConfigs here instead of ListOptions
// ListCRDs returns list of installed CRDs in the cluster and filters based on the given options
func (c *knDynamicClient) ListCRDs(options metav1.ListOptions) (*unstructured.UnstructuredList, error) {
func (c *knDynamicClient) ListCRDs(ctx context.Context, options metav1.ListOptions) (*unstructured.UnstructuredList, error) {
gvr := schema.GroupVersionResource{
Group: crdGroup,
Version: crdVersion,
Resource: crdKinds,
}

uList, err := c.client.Resource(gvr).List(context.TODO(), options)
uList, err := c.client.Resource(gvr).List(ctx, options)
if err != nil {
return nil, err
}
Expand All @@ -110,20 +110,20 @@ func (c *knDynamicClient) ListCRDs(options metav1.ListOptions) (*unstructured.Un
}

// ListSourcesTypes returns installed knative eventing sources CRDs
func (c *knDynamicClient) ListSourcesTypes() (*unstructured.UnstructuredList, error) {
func (c *knDynamicClient) ListSourcesTypes(ctx context.Context) (*unstructured.UnstructuredList, error) {
options := metav1.ListOptions{}
sourcesLabels := labels.Set{sourcesLabelKey: sourcesLabelValue}
options.LabelSelector = sourcesLabels.String()
return c.ListCRDs(options)
return c.ListCRDs(ctx, options)
}

// ListChannelsTypes returns installed knative channel CRDs
func (c *knDynamicClient) ListChannelsTypes() (*unstructured.UnstructuredList, error) {
func (c *knDynamicClient) ListChannelsTypes(ctx context.Context) (*unstructured.UnstructuredList, error) {
var ChannelTypeList unstructured.UnstructuredList
options := metav1.ListOptions{}
channelsLabels := labels.Set{messaging.SubscribableDuckVersionAnnotation: channelLabelValue}
options.LabelSelector = channelsLabels.String()
uList, err := c.ListCRDs(options)
uList, err := c.ListCRDs(ctx, options)
if err != nil {
return nil, err
}
Expand All @@ -148,12 +148,12 @@ func (c knDynamicClient) RawClient() dynamic.Interface {
// ListSources returns list of available sources objects
// Provide the list of source types as for example: WithTypes("pingsource", "apiserversource"...) to list
// only given types of source objects
func (c *knDynamicClient) ListSources(types ...WithType) (*unstructured.UnstructuredList, error) {
func (c *knDynamicClient) ListSources(ctx context.Context, types ...WithType) (*unstructured.UnstructuredList, error) {
var (
sourceList unstructured.UnstructuredList
options metav1.ListOptions
)
sourceTypes, err := c.ListSourcesTypes()
sourceTypes, err := c.ListSourcesTypes(ctx)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func (c *knDynamicClient) ListSources(types ...WithType) (*unstructured.Unstruct
}

// list objects of source type with this GVR
sList, err := c.client.Resource(gvr).Namespace(namespace).List(context.TODO(), options)
sList, err := c.client.Resource(gvr).Namespace(namespace).List(ctx, options)
if err != nil {
return nil, err
}
Expand All @@ -200,7 +200,7 @@ func (c *knDynamicClient) ListSources(types ...WithType) (*unstructured.Unstruct
}

// ListSourcesUsingGVKs returns list of available source objects using given list of GVKs
func (c *knDynamicClient) ListSourcesUsingGVKs(gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
func (c *knDynamicClient) ListSourcesUsingGVKs(ctx context.Context, gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
if gvks == nil {
return nil, nil
}
Expand All @@ -220,7 +220,7 @@ func (c *knDynamicClient) ListSourcesUsingGVKs(gvks *[]schema.GroupVersionKind,
gvr := gvk.GroupVersion().WithResource(strings.ToLower(gvk.Kind) + "s")

// list objects of source type with this GVR
sList, err := c.client.Resource(gvr).Namespace(namespace).List(context.TODO(), options)
sList, err := c.client.Resource(gvr).Namespace(namespace).List(ctx, options)
if err != nil {
return nil, err
}
Expand All @@ -236,7 +236,7 @@ func (c *knDynamicClient) ListSourcesUsingGVKs(gvks *[]schema.GroupVersionKind,
}

// ListChannelsUsingGVKs returns list of available channel objects using given list of GVKs
func (c *knDynamicClient) ListChannelsUsingGVKs(gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
func (c *knDynamicClient) ListChannelsUsingGVKs(ctx context.Context, gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
if gvks == nil {
return nil, nil
}
Expand All @@ -256,7 +256,7 @@ func (c *knDynamicClient) ListChannelsUsingGVKs(gvks *[]schema.GroupVersionKind,
gvr := gvk.GroupVersion().WithResource(strings.ToLower(gvk.Kind) + "s")

// list objects of channel type with this GVR
cList, err := c.client.Resource(gvr).Namespace(namespace).List(context.TODO(), options)
cList, err := c.client.Resource(gvr).Namespace(namespace).List(ctx, options)
if err != nil {
return nil, err
}
Expand Down
13 changes: 7 additions & 6 deletions pkg/dynamic/client_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package dynamic

import (
"context"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -66,7 +67,7 @@ func (dr *ClientRecorder) ListCRDs(options interface{}, ulist *unstructured.Unst
}

// ListCRDs returns list of installed CRDs in the cluster and filters based on the given options
func (c *MockKnDynamicClient) ListCRDs(options metav1.ListOptions) (*unstructured.UnstructuredList, error) {
func (c *MockKnDynamicClient) ListCRDs(ctx context.Context, options metav1.ListOptions) (*unstructured.UnstructuredList, error) {
call := c.recorder.r.VerifyCall("ListCRDs", options)
return call.Result[0].(*unstructured.UnstructuredList), mock.ErrorOrNil(call.Result[1])
}
Expand All @@ -77,7 +78,7 @@ func (dr *ClientRecorder) ListSourcesTypes(ulist *unstructured.UnstructuredList,
}

// ListSourcesTypes returns installed knative eventing sources CRDs
func (c *MockKnDynamicClient) ListSourcesTypes() (*unstructured.UnstructuredList, error) {
func (c *MockKnDynamicClient) ListSourcesTypes(context.Context) (*unstructured.UnstructuredList, error) {
call := c.recorder.r.VerifyCall("ListSourcesTypes")
return call.Result[0].(*unstructured.UnstructuredList), mock.ErrorOrNil(call.Result[1])
}
Expand All @@ -88,7 +89,7 @@ func (dr *ClientRecorder) ListChannelsTypes(ulist *unstructured.UnstructuredList
}

// ListChannelsTypes returns installed knative messaging CRDs
func (c *MockKnDynamicClient) ListChannelsTypes() (*unstructured.UnstructuredList, error) {
func (c *MockKnDynamicClient) ListChannelsTypes(context.Context) (*unstructured.UnstructuredList, error) {
call := c.recorder.r.VerifyCall("ListChannelsTypes")
return call.Result[0].(*unstructured.UnstructuredList), mock.ErrorOrNil(call.Result[1])
}
Expand All @@ -99,7 +100,7 @@ func (dr *ClientRecorder) ListSources(types interface{}, ulist *unstructured.Uns
}

// ListSources returns list of available sources objects
func (c *MockKnDynamicClient) ListSources(types ...WithType) (*unstructured.UnstructuredList, error) {
func (c *MockKnDynamicClient) ListSources(ctx context.Context, types ...WithType) (*unstructured.UnstructuredList, error) {
call := c.recorder.r.VerifyCall("ListSources")
return call.Result[0].(*unstructured.UnstructuredList), mock.ErrorOrNil(call.Result[1])
}
Expand All @@ -121,7 +122,7 @@ func (dr *ClientRecorder) ListSourcesUsingGVKs(gvks interface{}, types interface
}

// ListSourcesUsingGVKs returns list of available source objects using given list of GVKs
func (c *MockKnDynamicClient) ListSourcesUsingGVKs(gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
func (c *MockKnDynamicClient) ListSourcesUsingGVKs(ctx context.Context, gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
call := c.recorder.r.VerifyCall("ListSourcesUsingGVKs")
return call.Result[0].(*unstructured.UnstructuredList), mock.ErrorOrNil(call.Result[1])
}
Expand All @@ -137,7 +138,7 @@ func (dr *ClientRecorder) ListChannelsUsingGVKs(gvks interface{}, types interfac
}

// ListChannelsUsingGVKs returns list of available channel objects using given list of GVKs
func (c *MockKnDynamicClient) ListChannelsUsingGVKs(gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
func (c *MockKnDynamicClient) ListChannelsUsingGVKs(ctx context.Context, gvks *[]schema.GroupVersionKind, types ...WithType) (*unstructured.UnstructuredList, error) {
call := c.recorder.r.VerifyCall("ListChannelsUsingGVKs")
return call.Result[0].(*unstructured.UnstructuredList), mock.ErrorOrNil(call.Result[1])
}
14 changes: 8 additions & 6 deletions pkg/dynamic/client_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package dynamic

import (
"context"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -37,13 +38,14 @@ func TestMockKnDynamicClient(t *testing.T) {
recorder.ListSourcesUsingGVKs(mock.Any(), mock.Any(), nil, nil)
recorder.ListChannelsUsingGVKs(mock.Any(), mock.Any(), nil, nil)

client.ListCRDs(metav1.ListOptions{})
client.ListSourcesTypes()
client.ListChannelsTypes()
client.ListSources(WithTypeFilter("blub"))
ctx := context.Background()
client.ListCRDs(ctx, metav1.ListOptions{})
client.ListSourcesTypes(ctx)
client.ListChannelsTypes(ctx)
client.ListSources(ctx, WithTypeFilter("blub"))
client.RawClient()
client.ListSourcesUsingGVKs(&[]schema.GroupVersionKind{}, WithTypeFilter("blub"))
client.ListChannelsUsingGVKs(&[]schema.GroupVersionKind{}, WithTypeFilter("blub"))
client.ListSourcesUsingGVKs(ctx, &[]schema.GroupVersionKind{}, WithTypeFilter("blub"))
client.ListChannelsUsingGVKs(ctx, &[]schema.GroupVersionKind{}, WithTypeFilter("blub"))

// Validate
recorder.Validate()
Expand Down
31 changes: 16 additions & 15 deletions pkg/dynamic/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package dynamic

import (
"context"
"strings"
"testing"

Expand Down Expand Up @@ -50,7 +51,7 @@ func TestListCRDs(t *testing.T) {

t.Run("List CRDs with match", func(t *testing.T) {
options := metav1.ListOptions{}
uList, err := client.ListCRDs(options)
uList, err := client.ListCRDs(context.Background(), options)
assert.NilError(t, err)
assert.Equal(t, len(uList.Items), 2)
})
Expand All @@ -59,7 +60,7 @@ func TestListCRDs(t *testing.T) {
options := metav1.ListOptions{}
sourcesLabels := labels.Set{"duck.knative.dev/source": "true1"}
options.LabelSelector = sourcesLabels.String()
uList, err := client.ListCRDs(options)
uList, err := client.ListCRDs(context.Background(), options)
if err != nil {
t.Fatal(err)
}
Expand All @@ -76,7 +77,7 @@ func TestListSourceTypes(t *testing.T) {
)

t.Run("List source types", func(t *testing.T) {
uList, err := client.ListSourcesTypes()
uList, err := client.ListSourcesTypes(context.Background())
if err != nil {
t.Fatal(err)
}
Expand All @@ -93,14 +94,14 @@ func TestListSources(t *testing.T) {
obj := newSourceCRDObj("foo")
client := createFakeKnDynamicClient(testNamespace, obj)
assert.Check(t, client.RawClient() != nil)
_, err := client.ListSources()
_, err := client.ListSources(context.Background())
assert.Check(t, err != nil)
assert.Check(t, util.ContainsAll(err.Error(), "can't", "find", "source", "kind", "CRD"))
})

t.Run("sources not installed", func(t *testing.T) {
client := createFakeKnDynamicClient(testNamespace)
_, err := client.ListSources()
_, err := client.ListSources(context.Background())
assert.Check(t, err != nil)
assert.Check(t, util.ContainsAll(err.Error(), "no sources", "found", "backend", "verify", "installation"))
})
Expand All @@ -109,7 +110,7 @@ func TestListSources(t *testing.T) {
client := createFakeKnDynamicClient(testNamespace,
newSourceCRDObjWithSpec("pingsources", "sources.knative.dev", "v1alpha1", "PingSource"),
)
sources, err := client.ListSources()
sources, err := client.ListSources(context.Background())
assert.NilError(t, err)
assert.Equal(t, len(sources.Items), 0)
})
Expand All @@ -122,7 +123,7 @@ func TestListSources(t *testing.T) {
newSourceUnstructuredObj("a1", "sources.knative.dev/v1alpha1", "ApiServerSource"),
newSourceUnstructuredObj("c1", "sources.knative.dev/v1alpha1", "CronJobSource"),
)
sources, err := client.ListSources(WithTypeFilter("pingsource"), WithTypeFilter("ApiServerSource"))
sources, err := client.ListSources(context.Background(), WithTypeFilter("pingsource"), WithTypeFilter("ApiServerSource"))
assert.NilError(t, err)
assert.Equal(t, len(sources.Items), 2)
assert.DeepEqual(t, sources.GroupVersionKind(), schema.GroupVersionKind{Group: sourceListGroup, Version: sourceListVersion, Kind: sourceListKind})
Expand All @@ -133,7 +134,7 @@ func TestListSourcesUsingGVKs(t *testing.T) {
t.Run("No GVKs given", func(t *testing.T) {
client := createFakeKnDynamicClient(testNamespace)
assert.Check(t, client.RawClient() != nil)
s, err := client.ListSourcesUsingGVKs(nil)
s, err := client.ListSourcesUsingGVKs(context.Background(), nil)
assert.NilError(t, err)
assert.Check(t, s == nil)
})
Expand All @@ -149,7 +150,7 @@ func TestListSourcesUsingGVKs(t *testing.T) {
gv := schema.GroupVersion{Group: "sources.knative.dev", Version: "v1alpha1"}
gvks := []schema.GroupVersionKind{gv.WithKind("ApiServerSource"), gv.WithKind("PingSource")}

s, err := client.ListSourcesUsingGVKs(&gvks)
s, err := client.ListSourcesUsingGVKs(context.Background(), &gvks)
assert.NilError(t, err)
if s == nil {
t.Fatal("s = nil, want not nil")
Expand All @@ -158,7 +159,7 @@ func TestListSourcesUsingGVKs(t *testing.T) {
assert.DeepEqual(t, s.GroupVersionKind(), schema.GroupVersionKind{Group: sourceListGroup, Version: sourceListVersion, Kind: sourceListKind})

// withType
s, err = client.ListSourcesUsingGVKs(&gvks, WithTypeFilter("PingSource"))
s, err = client.ListSourcesUsingGVKs(context.Background(), &gvks, WithTypeFilter("PingSource"))
assert.NilError(t, err)
if s == nil {
t.Fatal("s = nil, want not nil")
Expand Down Expand Up @@ -306,7 +307,7 @@ func TestListChannelsTypes(t *testing.T) {
newChannelCRDObjWithSpec("InMemoryChannel", "messaging.knative.dev", "v1beta1", "InMemoryChannel"),
)

uList, err := client.ListChannelsTypes()
uList, err := client.ListChannelsTypes(context.Background())
if err != nil {
t.Fatal(err)
}
Expand All @@ -319,7 +320,7 @@ func TestListChannelsTypes(t *testing.T) {
testNamespace,
newChannelCRDObj("foo"),
)
uList, err := client.ListChannelsTypes()
uList, err := client.ListChannelsTypes(context.Background())
assert.Check(t, err == nil)
if err != nil {
t.Fatal(err)
Expand All @@ -333,7 +334,7 @@ func TestListChannelsUsingGVKs(t *testing.T) {
t.Run("No GVKs given", func(t *testing.T) {
client := createFakeKnDynamicClient(testNamespace)
assert.Check(t, client.RawClient() != nil)
s, err := client.ListChannelsUsingGVKs(nil)
s, err := client.ListChannelsUsingGVKs(context.Background(), nil)
assert.NilError(t, err)
assert.Check(t, s == nil)
})
Expand All @@ -347,7 +348,7 @@ func TestListChannelsUsingGVKs(t *testing.T) {
gv := schema.GroupVersion{Group: "messaging.knative.dev", Version: "v1beta1"}
gvks := []schema.GroupVersionKind{gv.WithKind("InMemoryChannel")}

s, err := client.ListChannelsUsingGVKs(&gvks)
s, err := client.ListChannelsUsingGVKs(context.Background(), &gvks)
assert.NilError(t, err)
if s == nil {
t.Fatal("s = nil, want not nil")
Expand All @@ -356,7 +357,7 @@ func TestListChannelsUsingGVKs(t *testing.T) {
assert.DeepEqual(t, s.GroupVersionKind(), schema.GroupVersionKind{Group: messaging.GroupName, Version: channelListVersion, Kind: channelListKind})

// withType
s, err = client.ListChannelsUsingGVKs(&gvks, WithTypeFilter("InMemoryChannel"))
s, err = client.ListChannelsUsingGVKs(context.Background(), &gvks, WithTypeFilter("InMemoryChannel"))
assert.NilError(t, err)
if s == nil {
t.Fatal("s = nil, want not nil")
Expand Down
Loading