This is an automated email from the ASF dual-hosted git repository. mmiller pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 82df376 Modify shutdown test in ManagerApiIT (#2333) 82df376 is described below commit 82df376b1fe5b222c6156a64afeac252beb26441 Author: Mike Miller <mmil...@apache.org> AuthorDate: Mon Nov 1 15:24:30 2021 -0400 Modify shutdown test in ManagerApiIT (#2333) * Closes #2327 * Rework last test to create 2 connections before shutting down --- .../accumulo/test/functional/ManagerApiIT.java | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java index 199cfab..1b39b4c 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java @@ -210,12 +210,19 @@ public class ManagerApiIT extends SharedMiniClusterBase { // see the junit annotation to control test ordering at the top of this class @Test public void z99_testPermissions_shutdown() throws Exception { - // To shutdown, user needs SystemPermission.SYSTEM - op = user -> client -> client.shutdown(null, user, false); - expectPermissionDenied(op, regularUser); - // We should be able to do both of the following RPC calls before it actually shuts down - expectPermissionSuccess(op, rootUser); - expectPermissionSuccess(op, privilegedUser); + // grab connections before shutting down + var rootUserBuilder = Accumulo.newClient().from(getClientProps()).as(rootUser.getPrincipal(), + rootUser.getToken()); + var privUserBuilder = Accumulo.newClient().from(getClientProps()) + .as(privilegedUser.getPrincipal(), privilegedUser.getToken()); + try (var rootClient = rootUserBuilder.build(); var privClient = privUserBuilder.build()) { + // To shutdown, user needs SystemPermission.SYSTEM + op = user -> client -> client.shutdown(null, user, false); + expectPermissionDenied(op, regularUser); + // We should be able to do both of the following RPC calls before it actually shuts down + expectPermissionSuccess(op, (ClientContext) rootClient); + expectPermissionSuccess(op, (ClientContext) privClient); + } } private static void expectPermissionSuccess( @@ -228,6 +235,12 @@ public class ManagerApiIT extends SharedMiniClusterBase { } } + private static void expectPermissionSuccess( + Function<TCredentials,ClientExec<ManagerClientService.Client>> op, ClientContext context) + throws Exception { + ManagerClient.executeVoid(context, op.apply(context.rpcCreds())); + } + private static void expectPermissionDenied( Function<TCredentials,ClientExec<ManagerClientService.Client>> op, Credentials user) throws Exception {