skoppu22 commented on code in PR #2648:
URL: https://github.com/apache/cassandra/pull/2648#discussion_r1332985152
##########
test/unit/org/apache/cassandra/tools/nodetool/InvalidateCIDRPermissionsCacheTest.java:
##########
@@ -118,10 +115,13 @@ public void testInvalidateSingleCidrPermission()
// ensure cidr permission is cached
role.hasAccessFromIp(ipAddr);
assertThat(originalReadsCount).isEqualTo(getCidrPermissionsReadCount());
+ assertThat(((CassandraCIDRAuthorizer)
DatabaseDescriptor.getCIDRAuthorizer()).has(ROLE_A)).isTrue();
// invalidate cidr permission
ToolRunner.ToolResult tool =
ToolRunner.invokeNodetool("invalidatecidrpermissionscache",
ROLE_A.getRoleName());
tool.assertOnCleanExit();
+ assertThat(tool.getStdout()).contains("Invalidated the role role_a
from CIDR permissions cache");
Review Comment:
Found a way. We can set high validity for cache, in the setup() before cache
gets created. Rest of the setup() code remains as it is.
```
@BeforeClass
public static void setup() throws Exception
{
DatabaseDescriptor.setRolesValidity(Integer.MAX_VALUE-1);
```
Once we do that, cache's expireAfterWrite gets set to 2147483646 ms, which
is 596+ hours, i.e, 24+ days.
- We do not need has(role) function. We can just verify that
`assertThat(tool.getStdout()).contains("Invalidated the role role_a from CIDR
permissions cache")` after invalidating a role in the test
testInvalidateSingleCidrPermission.
- Next unit test testInvalidateAllCidrPermissions doesn't go through the
code path we are changing as we discussed in thread
https://github.com/apache/cassandra/pull/2648/files#r1321766712
I will run the test under circle CI and let you know how it goes.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]