From 48c187efe8598dd7f845a02d5da75120d66f7cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Matavelli?= Date: Wed, 12 Feb 2020 10:07:17 +0000 Subject: [PATCH] Add invalid host test --- communicator/ssh/communicator_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/communicator/ssh/communicator_test.go b/communicator/ssh/communicator_test.go index c9db19df0..445fbebb9 100644 --- a/communicator/ssh/communicator_test.go +++ b/communicator/ssh/communicator_test.go @@ -149,6 +149,25 @@ func TestNew_Invalid(t *testing.T) { } } +func TestNew_InvalidHost(t *testing.T) { + r := &terraform.InstanceState{ + Ephemeral: terraform.EphemeralState{ + ConnInfo: map[string]string{ + "type": "ssh", + "user": "user", + "password": "i-am-invalid", + "port": "22", + "timeout": "30s", + }, + }, + } + + _, err := New(r) + if err == nil { + t.Fatal("should have had an error creating communicator") + } +} + func TestStart(t *testing.T) { address := newMockLineServer(t, nil, testClientPublicKey) parts := strings.Split(address, ":")