2020package org .apache .druid .testing .embedded .query ;
2121
2222
23- import org .apache .druid .common .utils .IdUtils ;
24- import org .apache .druid .indexing .common .task .IndexTask ;
2523import org .apache .druid .java .util .common .StringUtils ;
26- import org .apache .druid .testing .embedded .indexing .MoreResources ;
2724import org .junit .jupiter .api .Assertions ;
2825import org .junit .jupiter .api .Test ;
2926
3330 */
3431public class SystemTableQueryTest extends QueryTestBase
3532{
36- private final String dataSourceName1 = "table_a" ;
37- private final String dataSourceName2 = "table_b" ;
33+ private String dataSourceName1 ;
34+ private String dataSourceName2 ;
3835
3936 @ Override
4037 public void beforeAll ()
4138 {
42- final String taskId1 = IdUtils .getRandomId ();
43- final String taskId2 = IdUtils .getRandomId ();
44- final IndexTask task1 = MoreResources .Task .BASIC_INDEX .get ().dataSource (dataSourceName1 ).withId (taskId1 );
45- final IndexTask task2 = MoreResources .Task .BASIC_INDEX .get ().dataSource (dataSourceName2 ).withId (taskId2 );
46- cluster .callApi ().onLeaderOverlord (o -> o .runTask (taskId1 , task1 ));
47- cluster .callApi ().onLeaderOverlord (o -> o .runTask (taskId2 , task2 ));
48-
49- cluster .callApi ().waitForTaskToSucceed (taskId1 , overlord );
50- cluster .callApi ().waitForTaskToSucceed (taskId2 , overlord );
51-
52- cluster .callApi ().waitForAllSegmentsToBeAvailable (dataSourceName1 , coordinator , broker );
53- cluster .callApi ().waitForAllSegmentsToBeAvailable (dataSourceName2 , coordinator , broker );
39+ dataSourceName1 = ingestBasicData ();
40+ dataSourceName2 = ingestBasicData ();
5441 }
5542
5643 @ Test
@@ -66,10 +53,9 @@ public void testSystemTableQueries_segmentsCount()
6653 dataSourceName1 , dataSourceName2
6754 );
6855
69- String [] result = cluster .callApi ().runSql (query ).split ("\n " );
70- Assertions .assertEquals (2 , result .length );
71- Assertions .assertEquals (StringUtils .format ("%s,10" , dataSourceName1 ), result [0 ]);
72- Assertions .assertEquals (StringUtils .format ("%s,10" , dataSourceName2 ), result [1 ]);
56+ String result = cluster .callApi ().runSql (query );
57+ Assertions .assertTrue (result .contains (dataSourceName1 ));
58+ Assertions .assertTrue (result .contains (dataSourceName2 ));
7359 }
7460
7561 @ Test
0 commit comments