mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
E2E framework: fix nil pointer crash in TContext
Not all framework instances have a default namespace. TContext
crashed for those.
(cherry picked from commit 80cc14831e)
This got merged in https://github.com/kubernetes/kubernetes/pull/136140,
then reverted in https://github.com/kubernetes/kubernetes/pull/136151 and was
not brought back in https://github.com/kubernetes/kubernetes/pull/136156.
This commit is contained in:
@@ -187,7 +187,9 @@ func (f *Framework) TContext(ctx context.Context) ktesting.TContext {
|
||||
}
|
||||
tCtx := ktesting.InitCtx(ctx, f /* intentionally using f here and not f.TB because f overrides some methods */)
|
||||
tCtx = tCtx.WithClients(f.clientConfig, f.restMapper, f.ClientSet, f.DynamicClient, apiextensions.NewForConfigOrDie(f.clientConfig))
|
||||
tCtx = tCtx.WithNamespace(f.Namespace.Name)
|
||||
if f.Namespace != nil {
|
||||
tCtx = tCtx.WithNamespace(f.Namespace.Name)
|
||||
}
|
||||
tCtx = ensureLogger(tCtx)
|
||||
return tCtx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user