E2E framework: fix nil pointer crash in TContext

Not all framework instances have a default namespace. TContext
crashed for those.
This commit is contained in:
Patrick Ohly 2026-01-09 16:23:11 +01:00
parent 6f93518c7f
commit 80cc14831e

View file

@ -180,7 +180,9 @@ var _ ktesting.ContextTB = &Framework{}
func (f *Framework) TContext(ctx context.Context) ktesting.TContext {
tCtx := ktesting.InitCtx(ctx, f)
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
}