1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -540,9 +540,9 @@ def test_pod_log_empty_lines(self):
540
540
#Mock logs used for this test
541
541
w .stream = Mock (return_value = [
542
542
"Hello from Docker" ,
543
- "\n " , # Empty line
543
+ "" , # Empty line
544
544
"Another log line" ,
545
- "\n " , # Another empty line
545
+ "" , # Another empty line
546
546
"Final log"
547
547
])
548
548
for event in w .stream (self .api .read_namespaced_pod_log , name = pod_name , namespace = self .namespace , follow = True ):
@@ -552,7 +552,16 @@ def test_pod_log_empty_lines(self):
552
552
# Print outputs
553
553
print (f"Captured logs: { log_output } " )
554
554
# self.assertTrue(any("Hello from Docker" in line for line in log_output))
555
- self .assertTrue (any (line .strip () == "" for line in log_output ), "No empty lines found in logs" )
555
+ # self.assertTrue(any(line.strip() == "" for line in log_output), "No empty lines found in logs")
556
+ expected_log = [
557
+ "Hello from Docker" ,
558
+ "" ,
559
+ "Another log line" ,
560
+ "" ,
561
+ "Final log"
562
+ ]
563
+
564
+ self .assertEqual (log_output , expected_log , "Captured logs do not match expected logs" )
556
565
557
566
except ApiException as e :
558
567
self .fail (f"Kubernetes API exception: { e } " )
0 commit comments