resttest: Modify TestContext to have namespace in context

Previously, if a request is clusterscoped, the context that
was returned has no namespace, ideally the context should
contain a metav1.NamespaceNone as the namespace even for
cluster scoped requests.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
This commit is contained in:
Madhav Jivrajani 2022-02-10 12:54:15 +05:30
parent 40c2d04946
commit 412626f402

View File

@ -105,9 +105,6 @@ func (t *Tester) TestNamespace() string {
// TestContext returns a namespaced context that will be used when making storage calls.
// Namespace is determined by TestNamespace()
func (t *Tester) TestContext() context.Context {
if t.clusterScope {
return genericapirequest.NewContext()
}
return genericapirequest.WithNamespace(genericapirequest.NewContext(), t.TestNamespace())
}