Skip to content

Commit

Permalink
improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
coderzc committed Feb 23, 2023
1 parent d5cf128 commit 82178f0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ CompletableFuture<Void> asyncDeleteBucketSnapshot() {
if (ex != null) {
log.warn("[{}] Failed to delete bucket snapshot, bucketId: {}, bucketKey: {}",
dispatcher.getName(), bucketId, bucketKey, ex);
} else {
log.info("[{}] Delete bucket snapshot finish, bucketId: {}, bucketKey: {}",
dispatcher.getName(), bucketId, bucketKey);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public void injectCreateException(Throwable throwable) {
createExceptionQueue.add(throwable);
}

public void injectGetMetaDataExceptionQueue(Throwable throwable) {
public void injectGetMetaDataException(Throwable throwable) {
getMetaDataExceptionQueue.add(throwable);
}

public void injectGetSegmentExceptionQueue(Throwable throwable) {
public void injectGetSegmentException(Throwable throwable) {
getSegmentExceptionQueue.add(throwable);
}

public void injectDeleteExceptionQueue(Throwable throwable) {
public void injectDeleteException(Throwable throwable) {
deleteExceptionQueue.add(throwable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,18 @@ public void testWithBkException(BucketDelayedDeliveryTracker tracker) {
MockBucketSnapshotStorage mockBucketSnapshotStorage = (MockBucketSnapshotStorage) bucketSnapshotStorage;
mockBucketSnapshotStorage.injectCreateException(
new BucketSnapshotPersistenceException("Bookie operation timeout, op: Create entry"));
mockBucketSnapshotStorage.injectGetMetaDataExceptionQueue(
mockBucketSnapshotStorage.injectGetMetaDataException(
new BucketSnapshotPersistenceException("Bookie operation timeout, op: Get entry"));
mockBucketSnapshotStorage.injectGetSegmentExceptionQueue(
mockBucketSnapshotStorage.injectGetSegmentException(
new BucketSnapshotPersistenceException("Bookie operation timeout, op: Get entry"));
mockBucketSnapshotStorage.injectDeleteExceptionQueue(
mockBucketSnapshotStorage.injectDeleteException(
new BucketSnapshotPersistenceException("Bookie operation timeout, op: Delete entry"));

assertEquals(1, mockBucketSnapshotStorage.createExceptionQueue.size());
assertEquals(1, mockBucketSnapshotStorage.getMetaDataExceptionQueue.size());
assertEquals(1, mockBucketSnapshotStorage.getSegmentExceptionQueue.size());
assertEquals(1, mockBucketSnapshotStorage.deleteExceptionQueue.size());

for (int i = 1; i <= 110; i++) {
tracker.addMessage(i, i, i * 10);
}
Expand Down

0 comments on commit 82178f0

Please sign in to comment.