@@ -128,8 +128,10 @@ def test_test_read_log_chunks_should_read_one_try(self):
128
128
assert logs [0 ] == [
129
129
(
130
130
"localhost" ,
131
+ " INFO - ::group::Log message source details\n "
131
132
"*** Found local files:\n "
132
133
f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/1.log\n "
134
+ " INFO - ::endgroup::\n "
133
135
"try_number=1." ,
134
136
)
135
137
]
@@ -141,32 +143,13 @@ def test_test_read_log_chunks_should_read_all_files(self):
141
143
ti .state = TaskInstanceState .SUCCESS
142
144
logs , metadatas = task_log_reader .read_log_chunks (ti = ti , try_number = None , metadata = {})
143
145
144
- assert logs == [
145
- [
146
- (
147
- "localhost" ,
148
- "*** Found local files:\n "
149
- f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/1.log\n "
150
- "try_number=1." ,
151
- )
152
- ],
153
- [
154
- (
155
- "localhost" ,
156
- "*** Found local files:\n "
157
- f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/2.log\n "
158
- f"try_number=2." ,
159
- )
160
- ],
161
- [
162
- (
163
- "localhost" ,
164
- "*** Found local files:\n "
165
- f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/3.log\n "
166
- f"try_number=3." ,
167
- )
168
- ],
169
- ]
146
+ for i in range (0 , 3 ):
147
+ assert logs [i ][0 ][0 ] == "localhost"
148
+ assert (
149
+ "*** Found local files:\n "
150
+ f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/{ i + 1 } .log\n "
151
+ ) in logs [i ][0 ][1 ]
152
+ assert f"try_number={ i + 1 } ." in logs [i ][0 ][1 ]
170
153
assert metadatas == {"end_of_log" : True , "log_pos" : 13 }
171
154
172
155
def test_test_test_read_log_stream_should_read_one_try (self ):
@@ -175,27 +158,27 @@ def test_test_test_read_log_stream_should_read_one_try(self):
175
158
ti .state = TaskInstanceState .SUCCESS
176
159
stream = task_log_reader .read_log_stream (ti = ti , try_number = 1 , metadata = {})
177
160
assert list (stream ) == [
178
- "localhost\n *** Found local files:\n "
161
+ "localhost\n INFO - ::group::Log message source details \n *** Found local files:\n "
179
162
f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/1.log\n "
180
- "try_number =1.\n "
163
+ " INFO - ::endgroup:: \n try_number =1.\n "
181
164
]
182
165
183
166
def test_test_test_read_log_stream_should_read_all_logs (self ):
184
167
task_log_reader = TaskLogReader ()
185
168
self .ti .state = TaskInstanceState .SUCCESS # Ensure mocked instance is completed to return stream
186
169
stream = task_log_reader .read_log_stream (ti = self .ti , try_number = None , metadata = {})
187
170
assert list (stream ) == [
188
- "localhost\n *** Found local files:\n "
171
+ "localhost\n INFO - ::group::Log message source details \n *** Found local files:\n "
189
172
f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/1.log\n "
190
- "try_number =1."
173
+ " INFO - ::endgroup:: \n try_number =1."
191
174
"\n " ,
192
- "localhost\n *** Found local files:\n "
175
+ "localhost\n INFO - ::group::Log message source details \n *** Found local files:\n "
193
176
f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/2.log\n "
194
- "try_number =2."
177
+ " INFO - ::endgroup:: \n try_number =2."
195
178
"\n " ,
196
- "localhost\n *** Found local files:\n "
179
+ "localhost\n INFO - ::group::Log message source details \n *** Found local files:\n "
197
180
f"*** * { self .log_dir } /dag_log_reader/task_log_reader/2017-09-01T00.00.00+00.00/3.log\n "
198
- "try_number =3."
181
+ " INFO - ::endgroup:: \n try_number =3."
199
182
"\n " ,
200
183
]
201
184
0 commit comments