alamb commented on code in PR #18085:
URL: https://github.com/apache/datafusion/pull/18085#discussion_r2435947150


##########
datafusion-cli/src/object_storage/instrumented.rs:
##########
@@ -537,26 +662,14 @@ mod tests {
             extra_display: None,
         });
 
-        let summaries = RequestSummary::summarize_by_operation(&requests);
-        assert_eq!(summaries.len(), 1);
-
-        let summary = summaries.get(&Operation::Get).unwrap();
-        assert_eq!(summary.count, 1);
-        assert_eq!(
-            summary.duration_stats.as_ref().unwrap().min,
-            Duration::from_secs(5)
-        );
-        assert_eq!(
-            summary.duration_stats.as_ref().unwrap().max,
-            Duration::from_secs(5)
-        );
-        assert_eq!(
-            summary.duration_stats.as_ref().unwrap().sum,
-            Duration::from_secs(5)
-        );
-        assert_eq!(summary.size_stats.as_ref().unwrap().min, 100);
-        assert_eq!(summary.size_stats.as_ref().unwrap().max, 100);
-        assert_eq!(summary.size_stats.as_ref().unwrap().sum, 100);
+        assert_snapshot!(RequestSummaries::new(&requests), @r"
+        
+-----------+----------+-----------+-----------+-----------+-----------+
+        | Operation | Metric   | min       | max       | avg       | sum       
|
+        
+-----------+----------+-----------+-----------+-----------+-----------+
+        | Get       | duration | 5.000000s | 5.000000s | 5.000000s | 5.000000s 
|
+        | Get       | size     | 100 B     | 100 B     | 100 B     | 100 B     
|
+        
+-----------+----------+-----------+-----------+-----------+-----------+
+        ");

Review Comment:
   I agree that now the test (implicitly) also relies on display / conversion 
behavior which might make it harder to track down
   
   However, given the display output is also the end user API (aka what people 
will actually see) I think this is actually a good thing (it won't do any good 
if the summarizing logic is correct, but then it is not displayed correctly)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to