kapopken commented on a change in pull request #15002:
URL: https://github.com/apache/airflow/pull/15002#discussion_r602188331



##########
File path: tests/providers/microsoft/azure/log/test_wasb_task_handler.py
##########
@@ -98,7 +98,7 @@ def test_wasb_log_exists(self, mock_hook):
 
     @mock.patch("airflow.providers.microsoft.azure.hooks.wasb.WasbHook")
     def test_wasb_read(self, mock_hook):
-        mock_hook.return_value.read_file.return_value = 'Log line'
+        mock_hook.return_value.read_file.return_value = b'Log line'

Review comment:
       Hi the problem i'm solving is the the azure storage provider returns a 
utf encoded byte array and not a string. When storing logs in the remote 
storage you will get an error about converting bytes. 
   
   Repo steps, configure a AzureStorage storage as a remote log source for 
airflow and this error will occur. The pods will fail but the task will be 
marked as success.
   
   ```
   
    File “/usr/local/lib/python3.8/logging/__init__.py”, line 2123, in shutdown
       h.close()
     File 
“/root/.local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/log/wasb_task_handler.py”,
 line 97, in close
       self.wasb_write(log, remote_loc, append=True)
     File 
“/root/.local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/log/wasb_task_handler.py”,
 line 178, in wasb_write
       log = ‘\n’.join([old_log, log]) if old_log else log
   TypeError: sequence item 0: expected str instance, bytes found
   ```
   
   If you look at their SDK all versions of their provider from 12 forward have 
this return type. 




-- 
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.

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


Reply via email to