faft: Should wait a timeout period if network error on _sshd_test()
The _sshd_test() method tries to connect the DUT's ssh port. It uses
socket.create_connection() to connect. If the specified timeout meets,
this method returns. However, if other network error, like 'No route
to host", this method returns almost immediately. In this case, we
should add a delay to match the timing requirement.
BUG=chrome-os-partner:14171
TEST=Run firmware_FAFTSetup passed on Snow
Change-Id: I9983eb464bf7b893e76208fb60cdcc91111ba11f
Reviewed-on: https://gerrit.chromium.org/gerrit/33478
Reviewed-by: Mike Truty <truty@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/servo_test.py b/server/cros/servo_test.py
index 0784240..00350e2 100644
--- a/server/cros/servo_test.py
+++ b/server/cros/servo_test.py
@@ -174,7 +174,10 @@
sock = socket.create_connection((hostname, 22), timeout=timeout)
sock.close()
return True
+ except socket.timeout:
+ return False
except socket.error:
+ time.sleep(timeout)
return False