@Test
  public void testSuperuserCanRemoveQuota() throws Exception {
    // Create a table and write enough data to push it into quota violation
    final TableName tn = doAsSuperUser(new Callable<TableName>() {
      @Override
      public TableName call() throws Exception {
        try (Connection conn = getConnection()) {
          final Admin admin = conn.getAdmin();
          final TableName tn = helper.createTableWithRegions(admin, 5);
          final long sizeLimit = 2L * SpaceQuotaHelperForTests.ONE_MEGABYTE;
          QuotaSettings settings = QuotaSettingsFactory.limitTableSpace(tn, sizeLimit,
            SpaceViolationPolicy.NO_WRITES_COMPACTIONS);
          admin.setQuota(settings);
          // Grant the normal user permission to create a table and set a quota
          try {
            AccessControlClient.grant(conn, tn, REGULARUSER_NAME, null, null, Action.READ,
              Action.WRITE);
          } catch (Throwable t) {
            if (t instanceof Exception) {
              throw (Exception) t;
            }
            throw new Exception(t);
          }
          return tn;
        }
      }
    });

    // Write a bunch of data as our end-user
    doAsRegularUser(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        try (Connection conn = getConnection()) {
          helper.writeData(tn, 3L * SpaceQuotaHelperForTests.ONE_MEGABYTE);
          return null;
        }
      }
    });

    // Wait for the table to hit quota violation
    waitForTableToEnterQuotaViolation(tn);

    // Try to be "bad" and remove the quota as the end user (we want to write more data!)
    doAsRegularUser(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        try (Connection conn = getConnection()) {
          final Admin admin = conn.getAdmin();
          QuotaSettings qs = QuotaSettingsFactory.removeTableSpaceLimit(tn);
          try {
            admin.setQuota(qs);
            fail("Expected that an unprivileged user should not be allowed to remove a quota");
          } catch (Exception e) {
            // pass
          }
          return null;
        }
      }
    });

    // Verify that the superuser can remove the quota
    doAsSuperUser(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        try (Connection conn = getConnection()) {
          final Admin admin = conn.getAdmin();
          QuotaSettings qs = QuotaSettingsFactory.removeTableSpaceLimit(tn);
          admin.setQuota(qs);
          assertNull(helper.getTableSpaceQuota(conn, tn));
          return null;
        }
      }
    });
  }
Test class to verify that the HBase superuser can override quotas.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSuperUserQuotaPermissions.java