@@ -99,12 +99,7 @@ public void testSingleEnv() throws Exception {
9999 final List <TShowPipeInfo > showPipeResult =
100100 client .showPipe (new TShowPipeReq ().setUserName (SessionConfig .DEFAULT_USER )).pipeInfoList ;
101101 showPipeResult .removeIf (i -> i .getId ().startsWith ("__consensus" ));
102- Assert .assertEquals (2 , showPipeResult .size ());
103- Assert .assertTrue (
104- (Objects .equals (showPipeResult .get (0 ).id , "a2b_history" )
105- && Objects .equals (showPipeResult .get (1 ).id , "a2b_realtime" ))
106- || (Objects .equals (showPipeResult .get (1 ).id , "a2b_history" )
107- && Objects .equals (showPipeResult .get (0 ).id , "a2b_realtime" )));
102+ assertAutoSplitResult (showPipeResult , "a2b" );
108103 }
109104
110105 // Do not split for pipes without insertion or non-full
@@ -149,10 +144,11 @@ public void testSingleEnv() throws Exception {
149144 final List <TShowPipeInfo > showPipeResult =
150145 client .showPipe (new TShowPipeReq ().setUserName (SessionConfig .DEFAULT_USER )).pipeInfoList ;
151146 showPipeResult .removeIf (i -> i .getId ().startsWith ("__consensus" ));
152- Assert .assertTrue (
153- showPipeResult .stream ()
154- .filter (i -> Objects .equals (i .id , "a2b_history" ))
155- .anyMatch (i -> i .pipeConnector .contains ("enable-send-tsfile-limit=false" )));
147+ assertAutoSplitResult (showPipeResult , "a2b" );
148+ showPipeResult .stream ()
149+ .filter (i -> Objects .equals (i .id , "a2b_history" ))
150+ .forEach (
151+ i -> Assert .assertTrue (i .pipeConnector .contains ("enable-send-tsfile-limit=false" )));
156152 }
157153
158154 TestUtils .assertDataEventuallyOnEnv (
@@ -161,4 +157,18 @@ public void testSingleEnv() throws Exception {
161157 "Time,root.test.device.field," ,
162158 Collections .singleton ("1,2.0," ));
163159 }
160+
161+ private void assertAutoSplitResult (
162+ final List <TShowPipeInfo > showPipeResult , final String pipeName ) {
163+ // The history pipe may have already been auto-dropped after snapshot transfer completes.
164+ Assert .assertTrue (
165+ showPipeResult .stream ().anyMatch (i -> Objects .equals (i .id , pipeName + "_realtime" )));
166+ Assert .assertFalse (showPipeResult .stream ().anyMatch (i -> Objects .equals (i .id , pipeName )));
167+ Assert .assertTrue (
168+ showPipeResult .stream ()
169+ .allMatch (
170+ i ->
171+ Objects .equals (i .id , pipeName + "_history" )
172+ || Objects .equals (i .id , pipeName + "_realtime" )));
173+ }
164174}
0 commit comments