@Test
    public void testRetriesExhaustedBatchSize() throws Exception {
        HiveMetaStoreClient spyMSC = spy(msc);
        hive.setMSC(spyMSC);
        doThrow(MetaException.class).when(spyMSC).listPartitionsWithAuthInfoRequest(any());
        try {
            hive.getAllPartitionsInBatches(hive.getTable(dbName, tableName), NUM_PARTITIONS, DECAYING_FACTOR, MAX_RETRIES,
                    PARTIAL_PARTITION_SPEC, IS_AUTH_REQUIRED, USER_NAME, GROUP_NAMES);
        } catch (HiveException ignored) {}
        ArgumentCaptor<GetPartitionsPsWithAuthRequest> req = ArgumentCaptor.forClass(GetPartitionsPsWithAuthRequest.class);
        // there should be 5 call to get partitions with batch sizes as 30, 15, 7, 3, 1
        verify(spyMSC, times(5)).listPartitionsWithAuthInfoRequest(req.capture());
        List<GetPartitionsPsWithAuthRequest> apds = req.getAllValues();
        Assert.assertEquals(5, apds.size());

        Assert.assertEquals(30, apds.get(0).getPartNamesSize());
        Assert.assertEquals(15, apds.get(1).getPartNamesSize());
        Assert.assertEquals(7, apds.get(2).getPartNamesSize());
        Assert.assertEquals(3, apds.get(3).getPartNamesSize());
        Assert.assertEquals(1, apds.get(4).getPartNamesSize());
    }
Tests the retries exhausted case when getAllPartitionsOf method call always keep throwing
HiveException. The batch sizes should exponentially decreased based on the decaying factor and
ultimately give up when it reaches 0

@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/exec/TestGetPartitionAuthWithBatches.java