From commits-return-12378-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Sun Feb 4 14:39:30 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 0BA5718064A for ; Sun, 4 Feb 2018 14:39:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id EEF8D160C40; Sun, 4 Feb 2018 13:39:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 43189160C37 for ; Sun, 4 Feb 2018 14:39:29 +0100 (CET) Received: (qmail 56070 invoked by uid 500); 4 Feb 2018 13:39:28 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 56059 invoked by uid 99); 4 Feb 2018 13:39:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Feb 2018 13:39:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id ECABF180705 for ; Sun, 4 Feb 2018 13:39:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -11.731 X-Spam-Level: X-Spam-Status: No, score=-11.731 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id QyFtyacuFfm1 for ; Sun, 4 Feb 2018 13:39:26 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 2C2165F22E for ; Sun, 4 Feb 2018 13:39:26 +0000 (UTC) Received: (qmail 56049 invoked by uid 99); 4 Feb 2018 13:39:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Feb 2018 13:39:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 86C1BE9638; Sun, 4 Feb 2018 13:39:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: fokko@apache.org To: commits@airflow.incubator.apache.org Message-Id: <7621ce96de204e29a4d08d88f6062ff8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-airflow git commit: [AIRFLOW-1793] Use docker_url instead of invalid base_url Date: Sun, 4 Feb 2018 13:39:24 +0000 (UTC) Repository: incubator-airflow Updated Branches: refs/heads/master 15b8b7a85 -> 6f6030452 [AIRFLOW-1793] Use docker_url instead of invalid base_url Closes #2998 from kodieg/patch-3 Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/6f603045 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/6f603045 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/6f603045 Branch: refs/heads/master Commit: 6f60304529a6db0fc050590b821b288d64dcd992 Parents: 15b8b7a Author: kodieg Authored: Sun Feb 4 14:39:14 2018 +0100 Committer: Fokko Driesprong Committed: Sun Feb 4 14:39:14 2018 +0100 ---------------------------------------------------------------------- airflow/operators/docker_operator.py | 2 +- tests/operators/docker_operator.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/6f603045/airflow/operators/docker_operator.py ---------------------------------------------------------------------- diff --git a/airflow/operators/docker_operator.py b/airflow/operators/docker_operator.py index 38edc8b..adaabd2 100644 --- a/airflow/operators/docker_operator.py +++ b/airflow/operators/docker_operator.py @@ -147,7 +147,7 @@ class DockerOperator(BaseOperator): def get_hook(self): return DockerHook( docker_conn_id=self.docker_conn_id, - base_url=self.base_url, + base_url=self.docker_url, version=self.api_version, tls=self.__get_tls_config() ) http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/6f603045/tests/operators/docker_operator.py ---------------------------------------------------------------------- diff --git a/tests/operators/docker_operator.py b/tests/operators/docker_operator.py index a12b6f8..9ff60d2 100644 --- a/tests/operators/docker_operator.py +++ b/tests/operators/docker_operator.py @@ -187,8 +187,10 @@ class DockerOperatorTestCase(unittest.TestCase): 'Hook called though no docker_conn_id configured' ) + @mock.patch('airflow.operators.docker_operator.DockerHook') @mock.patch('airflow.operators.docker_operator.Client') - def test_execute_with_docker_conn_id_use_hook(self, operator_client_mock): + def test_execute_with_docker_conn_id_use_hook(self, operator_client_mock, + operator_docker_hook): # Mock out a Docker client, so operations don't raise errors client_mock = mock.Mock(name='DockerOperator.Client mock', spec=Client) client_mock.images.return_value = [] @@ -209,19 +211,16 @@ class DockerOperatorTestCase(unittest.TestCase): # Mock out the DockerHook hook_mock = mock.Mock(name='DockerHook mock', spec=DockerHook) hook_mock.get_conn.return_value = client_mock - operator.get_hook = mock.Mock( - name='DockerOperator.get_hook mock', - spec=DockerOperator.get_hook, - return_value=hook_mock - ) + operator_docker_hook.return_value = hook_mock operator.execute(None) + self.assertEqual( operator_client_mock.call_count, 0, 'Client was called on the operator instead of the hook' ) self.assertEqual( - operator.get_hook.call_count, 1, + operator_docker_hook.call_count, 1, 'Hook was not called although docker_conn_id configured' ) self.assertEqual(