maedhroz commented on a change in pull request #1205:
URL: https://github.com/apache/cassandra/pull/1205#discussion_r782603427
##########
File path: test/unit/org/apache/cassandra/auth/PasswordAuthenticatorTest.java
##########
@@ -161,18 +183,30 @@ private void testDecodeIllegalUserAndPwd(String username,
String password)
negotiator.getAuthenticatedUser();
}
- @BeforeClass
- public static void setUp()
+ @Test
+ public void warmCacheLoadsAllEntriesFromTables() throws Exception
Review comment:
nit: could remove `throws Exception`
##########
File path: test/unit/org/apache/cassandra/auth/PasswordAuthenticatorTest.java
##########
@@ -161,18 +183,30 @@ private void testDecodeIllegalUserAndPwd(String username,
String password)
negotiator.getAuthenticatedUser();
}
- @BeforeClass
- public static void setUp()
+ @Test
+ public void warmCacheLoadsAllEntriesFromTables() throws Exception
{
- SchemaLoader.createKeyspace(SchemaConstants.AUTH_KEYSPACE_NAME,
- KeyspaceParams.simple(1),
-
Iterables.toArray(AuthKeyspace.metadata().tables, TableMetadata.class));
- authenticator.setup();
+ IRoleManager roleManager = new
AuthTestUtils.LocalCassandraRoleManager();
+ roleManager.setup();
+ for (RoleResource r : ALL_ROLES)
+ {
+ RoleOptions options = new RoleOptions();
+ options.setOption(IRoleManager.Option.PASSWORD, "hash_for_" +
r.getRoleName());
+ roleManager.createRole(AuthenticatedUser.ANONYMOUS_USER, r,
options);
+ }
+
+ PasswordAuthenticator authenticator = new PasswordAuthenticator();
+ Map<String, String> cacheEntries = authenticator.bulkLoader().get();
+
+ assertEquals(ALL_ROLES.length, cacheEntries.size());
+ cacheEntries.forEach((username, hash) ->
assertTrue(BCrypt.checkpw("hash_for_" + username, hash)));
}
- @AfterClass
- public static void tearDown()
+ @Test
+ public void warmCacheWithEmptyTable() throws Exception
Review comment:
nit: could remove `throws Exception`
--
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]