From 0ac912f99e44e8e89985dd83ec946deadbfd8797 Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Thu, 9 Aug 2018 17:04:18 -0700 Subject: Fix runsc integration_test when using --network=host inethost doesn't support netlink and 'ifconfig' call to retrieve IP address fails. Look up IP address in /etc/hosts instead. PiperOrigin-RevId: 208135641 Change-Id: I3c2ce15db6fc7c3306a45e4bfb9cc5d4423ffad3 --- runsc/test/integration/integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runsc/test/integration') diff --git a/runsc/test/integration/integration_test.go b/runsc/test/integration/integration_test.go index c286e48d2..c6b546a56 100644 --- a/runsc/test/integration/integration_test.go +++ b/runsc/test/integration/integration_test.go @@ -162,8 +162,8 @@ func TestConnectToSelf(t *testing.T) { } defer d.CleanUp() - // Finds IP address for eth0. - ip, err := d.Exec("/bin/sh", "-c", "ifconfig eth0 | grep -E -o \".*inet [^ ]+\" | cut -d: -f2") + // Finds IP address for host. + ip, err := d.Exec("/bin/sh", "-c", "cat /etc/hosts | grep ${HOSTNAME} | awk '{print $1}'") if err != nil { t.Fatal("docker exec failed:", err) } -- cgit v1.2.3