brillo: Check device is online when connecting to wifi.
Ensure that a Brillo device is online before running the wifi tests.
BUG=b:27297360
TEST=./site_utils/test_droid.py brillo_PingTest --arg=ssid=GoogleGuest
Change-Id: I6b104ac7f766b45828eff02a77f0a993f02d734d
Reviewed-on: https://chromium-review.googlesource.com/338630
Commit-Ready: Ralph Nathan <ralphnathan@chromium.org>
Tested-by: Ralph Nathan <ralphnathan@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/server/brillo/host_utils.py b/server/brillo/host_utils.py
index db7b02f..d213be6 100644
--- a/server/brillo/host_utils.py
+++ b/server/brillo/host_utils.py
@@ -6,7 +6,6 @@
import contextlib
import logging
-import time
import common
from autotest_lib.client.bin import site_utils as client_site_utils
@@ -82,14 +81,11 @@
sleep_interval=1, timeout=300,
desc='shill was not started by init')
logging.info('Connecting to wifi')
- wifi_cmd = 'shill_setup_wifi --ssid=%s' % ssid
+ wifi_cmd = ('shill_setup_wifi --ssid=%s '
+ '--wait-for-online-seconds=%i' % (ssid, 300))
if passphrase:
wifi_cmd += ' --passphrase=%s' % passphrase
host.run(wifi_cmd)
- # TODO(ralphnathan): Once shill_setup_wifi can monitor the service as it
- # connects to wifi, remove this timeout.
- # Wait for wifi connection to occur.
- time.sleep(10)
yield
finally:
if ssid: