summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-08-09 17:04:18 -0700
committerShentubot <shentubot@google.com>2018-08-09 17:05:24 -0700
commit0ac912f99e44e8e89985dd83ec946deadbfd8797 (patch)
treecbb12946c14147cb5e8cc3cb0c50086505ef64c0
parent2e06b23aa61216fcdbefcd6b11a24bca7a456b16 (diff)
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
-rw-r--r--runsc/test/integration/integration_test.go4
1 files changed, 2 insertions, 2 deletions
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)
}