|
1 | 1 | package k8s |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "context" |
5 | 4 | "encoding/json" |
6 | 5 | "fmt" |
7 | 6 | "reflect" |
@@ -117,7 +116,7 @@ func sortGatheredResources(list []*api.GatheredResource) { |
117 | 116 | } |
118 | 117 |
|
119 | 118 | func TestNewDataGathererWithClientAndDynamicInformer(t *testing.T) { |
120 | | - ctx := context.Background() |
| 119 | + ctx := t.Context() |
121 | 120 | config := ConfigDynamic{ |
122 | 121 | ExcludeNamespaces: []string{"kube-system"}, |
123 | 122 | GroupVersionResource: schema.GroupVersionResource{Group: "foobar", Version: "v1", Resource: "foos"}, |
@@ -164,7 +163,7 @@ func TestNewDataGathererWithClientAndDynamicInformer(t *testing.T) { |
164 | 163 | } |
165 | 164 |
|
166 | 165 | func TestNewDataGathererWithClientAndSharedIndexInformer(t *testing.T) { |
167 | | - ctx := context.Background() |
| 166 | + ctx := t.Context() |
168 | 167 | config := ConfigDynamic{ |
169 | 168 | IncludeNamespaces: []string{"a"}, |
170 | 169 | GroupVersionResource: schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}, |
@@ -638,7 +637,7 @@ func TestDynamicGatherer_Fetch(t *testing.T) { |
638 | 637 | for name, tc := range tests { |
639 | 638 | t.Run(name, func(t *testing.T) { |
640 | 639 | var wg sync.WaitGroup |
641 | | - ctx := context.Background() |
| 640 | + ctx := t.Context() |
642 | 641 | gvrToListKind := map[schema.GroupVersionResource]string{ |
643 | 642 | {Group: "foobar", Version: "v1", Resource: "foos"}: "UnstructuredList", |
644 | 643 | {Group: "apps", Version: "v1", Resource: "deployments"}: "UnstructuredList", |
@@ -958,7 +957,7 @@ func TestDynamicGathererNativeResources_Fetch(t *testing.T) { |
958 | 957 | for name, tc := range tests { |
959 | 958 | t.Run(name, func(t *testing.T) { |
960 | 959 | var wg sync.WaitGroup |
961 | | - ctx := context.Background() |
| 960 | + ctx := t.Context() |
962 | 961 |
|
963 | 962 | clientset := fakeclientset.NewSimpleClientset(tc.addObjects...) |
964 | 963 |
|
|
0 commit comments