Copilot commented on code in PR #12833:
URL: https://github.com/apache/cloudstack/pull/12833#discussion_r2945931499


##########
plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/resource/NsxResourceTest.java:
##########
@@ -247,8 +249,11 @@ public void testCreatePortForwardRule() {
     @Test
     public void testDeleteNsxNatRule() {
         DeleteNsxNatRuleCommand cmd = new DeleteNsxNatRuleCommand(domainId, 
accountId, zoneId, 3L, "VPC01", true, 2L, 5L, "22", "tcp");
+        Network.Service service = new Network.Service("PortForwarding");

Review Comment:
   The test creates `new Network.Service("PortForwarding")`. `Network.Service` 
registers every constructed instance into a static `supportedServices` list, so 
this test mutates global state and can pollute/flake other tests. It also may 
not mirror the real (de)serialization behavior (which often bypasses 
constructors). Prefer using a Mockito mock/stub for `Network.Service` (only 
`getName()` is needed) or another approach that avoids mutating the static 
registry.
   



-- 
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