@@ -183,27 +183,13 @@ public void testTimechartWithLimit() throws IOException {
183183 schema ("host" , "string" ),
184184 schema ("avg(cpu_usage)" , "double" ));
185185
186- // Verify we have rows for web-01, web-02, and OTHER
187- boolean foundWeb01 = false ;
188- boolean foundWeb02 = false ;
189- boolean foundOther = false ;
190-
191- for (int i = 0 ; i < result .getJSONArray ("datarows" ).length (); i ++) {
192- Object [] row = result .getJSONArray ("datarows" ).getJSONArray (i ).toList ().toArray ();
193- String label = (String ) row [1 ];
194-
195- if ("web-01" .equals (label )) {
196- foundWeb01 = true ;
197- } else if ("web-02" .equals (label )) {
198- foundWeb02 = true ;
199- } else if ("OTHER" .equals (label )) {
200- foundOther = true ;
201- }
202- }
203-
204- assertTrue ("web-01 not found in results" , foundWeb01 );
205- assertTrue ("web-02 not found in results" , foundWeb02 );
206- assertTrue ("OTHER category not found in results" , foundOther );
186+ verifyDataRows (
187+ result ,
188+ rows ("2024-07-01 00:00:00" , "web-01" , 45.2 ),
189+ rows ("2024-07-01 00:01:00" , "OTHER" , 38.7 ),
190+ rows ("2024-07-01 00:02:00" , "web-01" , 55.3 ),
191+ rows ("2024-07-01 00:03:00" , "db-01" , 42.1 ),
192+ rows ("2024-07-01 00:04:00" , "OTHER" , 41.8 ));
207193 }
208194
209195 @ Test
@@ -383,7 +369,7 @@ public void testTimechartWithLimitAndUseOther() throws IOException {
383369
384370 if ("OTHER" .equals (host )) {
385371 foundOther = true ;
386- assertEquals (330.4 , cpuUsage , 0.1 );
372+ assertEquals (41.3 , cpuUsage , 0.1 );
387373 } else if ("web-03" .equals (host )) {
388374 foundWeb03 = true ;
389375 assertEquals (55.3 , cpuUsage , 0.1 );
0 commit comments