Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ public void testSingleEnv() throws Exception {
final List<TShowPipeInfo> showPipeResult =
client.showPipe(new TShowPipeReq().setUserName(SessionConfig.DEFAULT_USER)).pipeInfoList;
showPipeResult.removeIf(i -> i.getId().startsWith("__consensus"));
Assert.assertEquals(2, showPipeResult.size());
Assert.assertTrue(
(Objects.equals(showPipeResult.get(0).id, "a2b_history")
&& Objects.equals(showPipeResult.get(1).id, "a2b_realtime"))
|| (Objects.equals(showPipeResult.get(1).id, "a2b_history")
&& Objects.equals(showPipeResult.get(0).id, "a2b_realtime")));
assertAutoSplitResult(showPipeResult, "a2b");
}

// Do not split for pipes without insertion or non-full
Expand Down Expand Up @@ -149,10 +144,11 @@ public void testSingleEnv() throws Exception {
final List<TShowPipeInfo> showPipeResult =
client.showPipe(new TShowPipeReq().setUserName(SessionConfig.DEFAULT_USER)).pipeInfoList;
showPipeResult.removeIf(i -> i.getId().startsWith("__consensus"));
Assert.assertTrue(
showPipeResult.stream()
.filter(i -> Objects.equals(i.id, "a2b_history"))
.anyMatch(i -> i.pipeConnector.contains("enable-send-tsfile-limit=false")));
assertAutoSplitResult(showPipeResult, "a2b");
showPipeResult.stream()
.filter(i -> Objects.equals(i.id, "a2b_history"))
.forEach(
i -> Assert.assertTrue(i.pipeConnector.contains("enable-send-tsfile-limit=false")));
}

TestUtils.assertDataEventuallyOnEnv(
Expand All @@ -161,4 +157,18 @@ public void testSingleEnv() throws Exception {
"Time,root.test.device.field,",
Collections.singleton("1,2.0,"));
}

private void assertAutoSplitResult(
final List<TShowPipeInfo> showPipeResult, final String pipeName) {
// The history pipe may have already been auto-dropped after snapshot transfer completes.
Assert.assertTrue(
showPipeResult.stream().anyMatch(i -> Objects.equals(i.id, pipeName + "_realtime")));
Assert.assertFalse(showPipeResult.stream().anyMatch(i -> Objects.equals(i.id, pipeName)));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Assert.assertFalse(showPipeResult.stream().anyMatch(...)) can be written as assertTrue(showPipeResult.stream().noneMatch(i -> Objects.equals(i.id, pipeName))) for readability. Not blocking.

Assert.assertTrue(
showPipeResult.stream()
.allMatch(
i ->
Objects.equals(i.id, pipeName + "_history")
|| Objects.equals(i.id, pipeName + "_realtime")));
}
}
Loading