From 8b1a88d3874fefd917622a432a639b5f1cb03d34 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Thu, 9 Jun 2022 16:33:38 +0200 Subject: [PATCH] Close IcebergSplitSource in test --- .../iceberg/TestIcebergSplitSource.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java index 49d066633a3e6..0c4a383148ce7 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java @@ -141,7 +141,7 @@ public void testIncompleteDynamicFilterTimeout() false, Optional.empty()); - IcebergSplitSource splitSource = new IcebergSplitSource( + try (IcebergSplitSource splitSource = new IcebergSplitSource( tableHandle, nationTable.newScan(), Optional.empty(), @@ -188,21 +188,21 @@ public TupleDomain getCurrentPredicate() alwaysTrue(), new TestingTypeManager(), false, - new IcebergConfig().getMinimumAssignedSplitWeight()); - - ImmutableList.Builder splits = ImmutableList.builder(); - while (!splitSource.isFinished()) { - splitSource.getNextBatch(null, 100).get() - .getSplits() - .stream() - .map(IcebergSplit.class::cast) - .forEach(splits::add); + new IcebergConfig().getMinimumAssignedSplitWeight())) { + ImmutableList.Builder splits = ImmutableList.builder(); + while (!splitSource.isFinished()) { + splitSource.getNextBatch(null, 100).get() + .getSplits() + .stream() + .map(IcebergSplit.class::cast) + .forEach(splits::add); + } + assertThat(splits.build().size()).isGreaterThan(0); + assertTrue(splitSource.isFinished()); + assertThat(System.currentTimeMillis() - startMillis) + .as("IcebergSplitSource failed to wait for dynamicFilteringWaitTimeout") + .isGreaterThanOrEqualTo(2000); } - assertThat(splits.build().size()).isGreaterThan(0); - assertTrue(splitSource.isFinished()); - assertThat(System.currentTimeMillis() - startMillis) - .as("IcebergSplitSource failed to wait for dynamicFilteringWaitTimeout") - .isGreaterThanOrEqualTo(2000); } @Test