From patchwork Fri Nov 17 13:53:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 839003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3ydfhw1czhz9rvt; Sat, 18 Nov 2017 00:53:36 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1eFh5F-0001q1-HU; Fri, 17 Nov 2017 13:53:29 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1eFh5E-0001pp-6i for kernel-team@lists.ubuntu.com; Fri, 17 Nov 2017 13:53:28 +0000 Received: from 1.general.smb.uk.vpn ([10.172.193.28] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1eFh5D-0007KZ-UQ for kernel-team@lists.ubuntu.com; Fri, 17 Nov 2017 13:53:27 +0000 From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [autotest-client-tests] ubuntu_fan_smoke_test: Add DNS hinting for docker test Date: Fri, 17 Nov 2017 14:53:27 +0100 Message-Id: <1510926807-12463-1-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" When running in an environment which only has systemd-resolvd as DNS resolver, it is possible that docker cannot figure out the IP address of the real DNS server to use. Adding --dns in that case to avoid issues. Signed-off-by: Stefan Bader Acked-by: Po-Hsu Lin --- ubuntu_fan_smoke_test/smoke_test_old.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ubuntu_fan_smoke_test/smoke_test_old.sh b/ubuntu_fan_smoke_test/smoke_test_old.sh index 9622575..eb0d2dc 100755 --- a/ubuntu_fan_smoke_test/smoke_test_old.sh +++ b/ubuntu_fan_smoke_test/smoke_test_old.sh @@ -128,7 +128,7 @@ fanatic_enable_docker_test() fanatic_docker_test() { - echo -n "fanatic docker test: " + echo -n "fanatic docker test" enable_fan info=$(ip address | ./extract-fan-info) @@ -136,7 +136,22 @@ fanatic_docker_test() fan_addr=$(echo $info | cut -d: -f2) enable_docker service docker restart - docker run $image sh -c "apt-get update && apt-get install iputils-ping -y && ping -c 10 $fan_addr" > $TMP + + # Docker needs DNS hinting if systemd-resolvd is in charge + dns_opt="" + dns1=$(awk '$1=="nameserver"{print $2; exit}' /etc/resolv.conf) + if [ "$dns1" = "127.0.0.53" ]; then + dns_opt="--dns=$(systemd-resolve --status | + awk '/DNS Servers:/{ + sub(/.*DNS Servers: */, "") + sub(/,.*/, "") + print + exit}')" + echo -n "($dns_opt): " + else + echo -n ": " + fi + docker run $dns_opt $image sh -c "apt-get update && apt-get install iputils-ping -y && ping -c 10 $fan_addr" > $TMP ret=$? if [ $ret -ne 0 ]; then echo "FAILED: (docker run returned $ret)"