From 8c3a92b07f0342af262b280857ef6b64ddd8af67 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Mon, 21 Oct 2024 19:06:19 +0300 Subject: [PATCH] Streamline testcontext private names Signed-off-by: Nir Soffer --- e2e/testcontext/testcontext.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/testcontext/testcontext.go b/e2e/testcontext/testcontext.go index 3c4c32198..312303c22 100644 --- a/e2e/testcontext/testcontext.go +++ b/e2e/testcontext/testcontext.go @@ -16,15 +16,15 @@ type TestContext struct { Deployer deployers.Deployer } -var testContextMap = make(map[string]TestContext) +var contexts = make(map[string]TestContext) // Based on name passed, Init the deployer and Workload and stash in a map[string]TestContext func AddTestContext(name string, w workloads.Workload, d deployers.Deployer) { - testContextMap[name] = TestContext{w, d} + contexts[name] = TestContext{w, d} } func DeleteTestContext(name string) { - delete(testContextMap, name) + delete(contexts, name) } // Search name in map for a TestContext to return, if not found go backward @@ -33,14 +33,14 @@ func DeleteTestContext(name string) { // - Search for above name first (it will not be found as we create context at a point where we have a d+w) // - Search for "TestSuites/Exhaustive/DaemonSet/Subscription" (should be found) func GetTestContext(name string) (TestContext, error) { - testCtx, ok := testContextMap[name] + testCtx, ok := contexts[name] if !ok { i := strings.LastIndex(name, "/") if i < 1 { return TestContext{}, fmt.Errorf("not a valid name in TestContext: %v", name) } - testCtx, ok = testContextMap[name[0:i]] + testCtx, ok = contexts[name[0:i]] if !ok { return TestContext{}, fmt.Errorf("can not find testContext with name: %v", name) }