From 235e565e9f701043a50d775923f41b307564452b Mon Sep 17 00:00:00 2001 From: stavdav143 <58971745+stavdav143@users.noreply.github.com> Date: Sun, 3 Dec 2023 21:16:31 +0000 Subject: [PATCH] Reverting as Github actions don't run this test as a swarm node: docker.errors.APIError: 503 Server Error for http+docker://localhost/v1.43/services/create: Service Unavailable ("This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.") Revert "Final commit of this PR marking the test case that validates logging in the Docker Swarm Operator. We log two times a different message and we assert that the two lines are given back in the logs in the expected sequence." This reverts commit 048ba1ece25fcd02c5ccc752d63759c76b098e44. --- .../docker/operators/test_docker_swarm.py | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/tests/providers/docker/operators/test_docker_swarm.py b/tests/providers/docker/operators/test_docker_swarm.py index d856f1ad2c7ad..94d4b4e032662 100644 --- a/tests/providers/docker/operators/test_docker_swarm.py +++ b/tests/providers/docker/operators/test_docker_swarm.py @@ -17,7 +17,7 @@ # under the License. from __future__ import annotations -from unittest import TestCase, mock +from unittest import mock import pytest from docker import APIClient, types @@ -209,33 +209,3 @@ def test_on_kill_client_not_created(self, docker_api_client_patcher): op.on_kill() docker_api_client_patcher.return_value.remove_service.assert_not_called() mock_service.assert_not_called() - - def test_logging(self): - """ - Test logging of operator. - """ - operator = DockerSwarmOperator( - command=""" - /bin/bash -c ' - echo "Test message 1"; - echo "Test message 2"; - ' - """, - environment={"UNIT": "TEST"}, - image="ubuntu:latest", - task_id="unit_test_logging", - enable_logging=True, - tty=False, - docker_url="unix://var/run/docker.sock", - mode=types.ServiceMode(mode="replicated-job"), - ) - - this_test = TestCase() - with this_test.assertLogs("airflow.task.operators", level="INFO") as logs: - operator.execute(None) - - logs = "\n".join(logs.output) - this_test.assertRegex( - logs, - r"INFO:airflow\.task\.operators\.airflow\.providers\.docker\.operators\.docker_swarm.DockerSwarmOperator:Test message 1\nINFO:airflow\.task\.operators\.airflow\.providers\.docker\.operators\.docker_swarm.DockerSwarmOperator:Test message 2\n", - )