diff --git a/internal/venice-common/src/main/java/com/linkedin/venice/status/PushJobDetailsStatus.java b/internal/venice-common/src/main/java/com/linkedin/venice/status/PushJobDetailsStatus.java index da182bf49e..736f9e58cb 100644 --- a/internal/venice-common/src/main/java/com/linkedin/venice/status/PushJobDetailsStatus.java +++ b/internal/venice-common/src/main/java/com/linkedin/venice/status/PushJobDetailsStatus.java @@ -14,7 +14,7 @@ public enum PushJobDetailsStatus { private static final Set TERMINAL_STATUSES = new HashSet<>(Arrays.asList(COMPLETED.getValue(), ERROR.getValue(), KILLED.getValue())); - public static final Set TERMINAL_FAILED_STATUSES = new HashSet<>(Arrays.asList(ERROR, KILLED)); + private static final Set TERMINAL_FAILED_STATUSES = new HashSet<>(Arrays.asList(ERROR, KILLED)); private final int value; PushJobDetailsStatus(int value) { diff --git a/internal/venice-common/src/test/java/com/linkedin/venice/status/TestPushJobDetailsStatus.java b/internal/venice-common/src/test/java/com/linkedin/venice/status/TestPushJobDetailsStatus.java new file mode 100644 index 0000000000..82f72c1da9 --- /dev/null +++ b/internal/venice-common/src/test/java/com/linkedin/venice/status/TestPushJobDetailsStatus.java @@ -0,0 +1,41 @@ +package com.linkedin.venice.status; + +import static com.linkedin.venice.status.PushJobDetailsStatus.COMPLETED; +import static com.linkedin.venice.status.PushJobDetailsStatus.ERROR; +import static com.linkedin.venice.status.PushJobDetailsStatus.KILLED; +import static com.linkedin.venice.status.PushJobDetailsStatus.isFailed; +import static com.linkedin.venice.status.PushJobDetailsStatus.isSucceeded; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Test; + + +public class TestPushJobDetailsStatus { + @Test + public void testIsFailedOrIsSuccess() { + for (PushJobDetailsStatus status: PushJobDetailsStatus.values()) { + if (status == COMPLETED) { + assertTrue(isSucceeded(status)); + assertFalse(isFailed(status)); + } else if (status == ERROR || status == KILLED) { + assertTrue(isFailed(status)); + assertFalse(isSucceeded(status)); + } else { + assertFalse(isSucceeded(status)); + assertFalse(isFailed(status)); + } + } + } + + @Test + public void testIsTerminal() { + for (PushJobDetailsStatus status: PushJobDetailsStatus.values()) { + if (status == COMPLETED || status == ERROR || status == KILLED) { + assertTrue(PushJobDetailsStatus.isTerminal(status.getValue())); + } else { + assertFalse(PushJobDetailsStatus.isTerminal(status.getValue())); + } + } + } +} diff --git a/services/venice-controller/src/test/java/com/linkedin/venice/controller/TestPushJobStatusStats.java b/services/venice-controller/src/test/java/com/linkedin/venice/controller/TestPushJobStatusStats.java index fd010fc6bf..51f63d7dd4 100644 --- a/services/venice-controller/src/test/java/com/linkedin/venice/controller/TestPushJobStatusStats.java +++ b/services/venice-controller/src/test/java/com/linkedin/venice/controller/TestPushJobStatusStats.java @@ -2,9 +2,6 @@ import static com.linkedin.venice.controller.VeniceHelixAdmin.emitPushJobDetailsMetrics; import static com.linkedin.venice.controller.VeniceHelixAdmin.isPushJobFailedUserError; -import static com.linkedin.venice.status.PushJobDetailsStatus.COMPLETED; -import static com.linkedin.venice.status.PushJobDetailsStatus.ERROR; -import static com.linkedin.venice.status.PushJobDetailsStatus.KILLED; import static com.linkedin.venice.status.PushJobDetailsStatus.isFailed; import static com.linkedin.venice.status.PushJobDetailsStatus.isSucceeded; import static org.mockito.Mockito.mock; @@ -29,22 +26,6 @@ public class TestPushJobStatusStats { - @Test - public void testIsFailedOrIsSuccess() { - for (PushJobDetailsStatus status: PushJobDetailsStatus.values()) { - if (status == COMPLETED) { - assertTrue(isSucceeded(status)); - assertFalse(isFailed(status)); - } else if (status == ERROR || status == KILLED) { - assertTrue(isFailed(status)); - assertFalse(isSucceeded(status)); - } else { - assertFalse(isSucceeded(status)); - assertFalse(isFailed(status)); - } - } - } - @Test(dataProvider = "True-and-False", dataProviderClass = DataProviderUtils.class) public void testEmitPushJobDetailsMetrics(boolean isIncrementalPush) { PushJobDetails details = mock(PushJobDetails.class);