traeak commented on code in PR #12593:
URL: https://github.com/apache/trafficserver/pull/12593#discussion_r4445150962


##########
src/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc:
##########
@@ -58,6 +58,25 @@ SCENARIO("factory tests loading yaml configs", 
"[loadConfig]")
       }
     }
 
+    WHEN("strategy distances are checked.")
+    {
+      THEN("each strategy has a unique, stable index and lookups do not mutate 
it")
+      {
+        NextHopSelectionStrategy *const s1 = 
nhf.strategyInstance("strategy-1");
+        NextHopSelectionStrategy *const s2 = 
nhf.strategyInstance("strategy-2");
+        REQUIRE(s1 != nullptr);
+        REQUIRE(s2 != nullptr);
+
+        CHECK(s1->distance != s2->distance);
+        CHECK(s1->distance < 2);
+        CHECK(s2->distance < 2);
+
+        const uint32_t d1 = s1->distance;
+        nhf.strategyInstance("strategy-1");
+        CHECK(s1->distance == d1);
+      }

Review Comment:
   addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to