use of io.pravega.controller.store.PravegaTablesStoreHelper in project pravega by pravega.
the class PravegaTablesKVTMetadataStoreTest method testPartiallyDeletedScope.
@Test(timeout = 30000)
public void testPartiallyDeletedScope() throws Exception {
final String scopeName = "partialScope";
PravegaTablesStoreHelper storeHelperSpy = spy(new PravegaTablesStoreHelper(segmentHelperMockForTables, GrpcAuthHelper.getDisabledAuthHelper(), executor));
WireCommandFailedException wcfe = new WireCommandFailedException(WireCommandType.READ_TABLE_KEYS, WireCommandFailedException.Reason.TableKeyDoesNotExist);
when(storeHelperSpy.getKeysPaginated(anyString(), any(), anyInt(), anyLong())).thenReturn(CompletableFuture.failedFuture(new CompletionException(StoreException.create(StoreException.Type.DATA_NOT_FOUND, wcfe, "kvTablesInScope not found."))));
StreamMetadataStore testStreamStore = TestStreamStoreFactory.createPravegaTablesStreamStore(PRAVEGA_ZK_CURATOR_RESOURCE.client, executor, storeHelperSpy);
KVTableMetadataStore testKVStore = TestStreamStoreFactory.createPravegaTablesKVStore(PRAVEGA_ZK_CURATOR_RESOURCE.client, executor, storeHelperSpy);
OperationContext context = testStreamStore.createScopeContext(scopeName, 0L);
CompletableFuture<Controller.CreateScopeStatus> createScopeFuture = testStreamStore.createScope(scopeName, context, executor);
Controller.CreateScopeStatus status = createScopeFuture.get();
Assert.assertEquals(Controller.CreateScopeStatus.Status.SUCCESS, status.getStatus());
String token = Controller.ContinuationToken.newBuilder().build().getToken();
Pair<List<String>, String> kvtList = testKVStore.listKeyValueTables(scopeName, token, 2, context, executor).get();
Assert.assertEquals(0, kvtList.getKey().size());
Assert.assertEquals(token, kvtList.getValue());
}
Aggregations