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
This commit is contained in:
Fabricio Voznika 2018-08-09 17:04:18 -07:00 committed by Shentubot
parent 2e06b23aa6
commit 0ac912f99e
1 changed files with 2 additions and 2 deletions

View File

@ -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)
}