Acloud: acloud create failed to create ssh tunnel but still did adb connect.
Test: atest acloud_test && m acloud &&
acloud create
Bug: 120114903
Change-Id: I371869234f75990f3d51ece6155e0b32cafa8314
diff --git a/internal/lib/utils_test.py b/internal/lib/utils_test.py
index 8c8a460..9a7ffc4 100644
--- a/internal/lib/utils_test.py
+++ b/internal/lib/utils_test.py
@@ -399,6 +399,23 @@
except errors.FunctionTimeoutError:
self.fail("shouldn't timeout")
+ def testAutoConnectCreateSSHTunnelFail(self):
+ """test auto connect."""
+ fake_ip_addr = "1.1.1.1"
+ fake_rsa_key_file = "/tmp/rsa_file"
+ fake_target_vnc_port = 8888
+ target_adb_port = 9999
+ ssh_user = "fake_user"
+ call_side_effect = subprocess.CalledProcessError(123, "fake",
+ "fake error")
+ result = utils.ForwardedPorts(vnc_port=None, adb_port=None)
+ self.Patch(subprocess, "check_call", side_effect=call_side_effect)
+ self.assertEqual(result, utils.AutoConnect(fake_ip_addr,
+ fake_rsa_key_file,
+ fake_target_vnc_port,
+ target_adb_port,
+ ssh_user))
+
if __name__ == "__main__":
unittest.main()