Lee-W commented on code in PR #41416:
URL: https://github.com/apache/airflow/pull/41416#discussion_r1721909189
##########
tests/providers/docker/operators/test_docker_swarm.py:
##########
@@ -345,3 +351,46 @@ def test_service_args_list(self, types_mock,
docker_api_client_patcher):
configs=None,
secrets=None,
)
+
+ @mock.patch("airflow.providers.docker.operators.docker_swarm.types")
+ def test_logging_driver(self, types_mock, docker_api_client_patcher):
+ mock_obj = mock.Mock()
+
+ client_mock = mock.Mock(spec=APIClient)
+ client_mock.create_service.return_value = {"ID": "some_id"}
+ client_mock.images.return_value = []
+ client_mock.pull.return_value = [b'{"status":"pull log"}']
+ client_mock.tasks.return_value = [{"Status": {"State": "complete"}}]
+ types_mock.TaskTemplate.return_value = mock_obj
+ types_mock.ContainerSpec.return_value = mock_obj
+ types_mock.RestartPolicy.return_value = mock_obj
+ types_mock.Resources.return_value = mock_obj
+
+ docker_api_client_patcher.return_value = client_mock
+
+ operator = DockerSwarmOperator(
+ image="", logging_driver="json-file", task_id="unittest",
enable_logging=False
+ )
+ operator.execute(None)
Review Comment:
we probably would want to assert that the logging drive is "json-file" here
```suggestion
assert operator.logging_driver == "json-file"
```
--
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]