smholsen commented on code in PR #3203:
URL: https://github.com/apache/tinkerpop/pull/3203#discussion_r2343644195
##########
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientConnectionIntegrateTest.java:
##########
@@ -227,10 +227,17 @@ public void
overLimitOperationsShouldDelegateToSingleNewConnection() throws Inte
}
});
- assertEquals(2, connectionBorrowCount.size());
- for (int finalBorrowCount : connectionBorrowCount.values()) {
- assertEquals(usagePerConnection, finalBorrowCount);
- }
+ // The intent of this test is to ensure that the driver grows from 1
connection to only as many as needed to satisfy
maxSimultaneousUsagePerConnection limits
+ // (i.e. 2 fully utilized connections at 3 operations each for a total
of 6 operations).
+ // On CI / Github runners, ephemeral third connections can appear.
Review Comment:
Makes sense!
First time looking into this repo at all, so apologies if my investigation
is a bit lacking here.
Looking a bit further here I have an assumption which would be great if you
could validate:
We have `.maxConnectionPoolSize(operations)` (which I think is not correct
for this test? I assume this should actually be 2, since we have 6 operations,
and 3 `usagePerConnection`. )
When `invokeAll` is called, it calls `chooseConnection` on all 6. In turn,
this will cal `pool.borrowConnection(...)`, which again calls sets its
connection with `final Connection leastUsedConn =
getLeastUsedValidConnection();`.
`getLeastUsedValidConnection` actually has this comment:
```
// Increment borrow count and consider making a new connection if least used
connection hits usage maximum
```
So for the last one of this, we will have 2 full connections (each filled
with 3 operations). Since we have a `maxPoolSize` of > 2, it will create the
third.
So perhaps we can just leave the test as is, and set
`.maxConnectionPoolSize(2)`?
--
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]