From cd01cf879ce9a78d9c6c6bf62e099b4bc9934f59 Mon Sep 17 00:00:00 2001 From: Peng Huo Date: Fri, 27 Oct 2023 21:00:42 -0700 Subject: [PATCH] fix ut coverage Signed-off-by: Peng Huo --- .../spark/leasemanager/DefaultLeaseManager.java | 2 -- .../leasemanager/DefaultLeaseManagerTest.java | 14 +++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/spark/src/main/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManager.java b/spark/src/main/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManager.java index e8e2036d1a..1635a1801b 100644 --- a/spark/src/main/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManager.java +++ b/spark/src/main/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManager.java @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.List; import java.util.function.Predicate; -import lombok.RequiredArgsConstructor; import org.opensearch.sql.common.setting.Settings; import org.opensearch.sql.spark.dispatcher.model.JobType; import org.opensearch.sql.spark.execution.statestore.StateStore; @@ -49,7 +48,6 @@ interface Rule extends Predicate { String description(); } - @RequiredArgsConstructor public class ConcurrentSessionRule implements Rule { @Override public String description() { diff --git a/spark/src/test/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManagerTest.java b/spark/src/test/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManagerTest.java index 7691f386d3..47111c3a38 100644 --- a/spark/src/test/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManagerTest.java +++ b/spark/src/test/java/org/opensearch/sql/spark/leasemanager/DefaultLeaseManagerTest.java @@ -5,15 +5,23 @@ package org.opensearch.sql.spark.leasemanager; -import static org.junit.jupiter.api.Assertions.*; - import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.opensearch.sql.common.setting.Settings; +import org.opensearch.sql.spark.dispatcher.model.JobType; +import org.opensearch.sql.spark.execution.statestore.StateStore; +import org.opensearch.sql.spark.leasemanager.model.LeaseRequest; @ExtendWith(MockitoExtension.class) class DefaultLeaseManagerTest { + @Mock private Settings settings; + + @Mock private StateStore stateStore; @Test - public void concurrentSessionRuleOnlyApplyToInteractiveQuery() {} + public void concurrentSessionRuleOnlyApplyToInteractiveQuery() { + new DefaultLeaseManager(settings, stateStore).borrow(new LeaseRequest(JobType.BATCH, "mys3")); + } }