Skip to content

Fix unit tests / Travis#238

Merged
shazow merged 3 commits intoshazow:masterfrom
ograff:fix_unit_tests
Jun 14, 2017
Merged

Fix unit tests / Travis#238
shazow merged 3 commits intoshazow:masterfrom
ograff:fix_unit_tests

Conversation

@ograff
Copy link
Copy Markdown
Contributor

@ograff ograff commented Jun 14, 2017

No description provided.

@ograff ograff changed the title (WIP) Fix unit tests Fix unit tests / Travis Jun 14, 2017
@ograff
Copy link
Copy Markdown
Contributor Author

ograff commented Jun 14, 2017

Fixes #231
To be honest I'm not sure why the signature originally was that it was hanging, that might be an issue in itself, but things are green now!

@ograff
Copy link
Copy Markdown
Contributor Author

ograff commented Jun 14, 2017

Looks like we were never feeding channels that were waiting if the SSH connection errored out. Fixed.

Testing:

23:08:17  ograff@Olivers-MacBook-Air  ...github.com/shazow/ssh-chat   master ✔ 
$ git checkout -b fix_hang_but_not_test
Switched to a new branch 'fix_hang_but_not_test'

 23:08:27  ograff@Olivers-MacBook-Air  ...github.com/shazow/ssh-chat   fix_hang_but_not_test ✔ 
$ git show fix_unit_tests | cat
commit c073e1f3f0fad434d86ac6f63be99dfc0b3fe535
Author: Oliver Graff <[email protected]>
Date:   Tue Jun 13 22:57:32 2017 -0700

    Fix host_test so it will not hang if the SSH connection fails

diff --git a/host_test.go b/host_test.go
index 334506e..f98724a 100644
--- a/host_test.go
+++ b/host_test.go
@@ -97,6 +97,7 @@ func TestHostNameCollision(t *testing.T) {
 			return nil
 		})
 		if err != nil {
+			done <- struct{}{}
 			t.Fatal(err)
 		}
 	}()
@@ -203,6 +204,7 @@ func TestHostKick(t *testing.T) {
 			return nil
 		})
 		if err != nil {
+			connected <- struct{}{}
 			close(connected)
 			t.Fatal(err)
 		}
@@ -218,6 +220,7 @@ func TestHostKick(t *testing.T) {
 			return nil
 		})
 		if err != nil {
+			close(done)
 			t.Fatal(err)
 		}
 		close(done)

 23:08:34  ograff@Olivers-MacBook-Air  ...github.com/shazow/ssh-chat   fix_hang_but_not_test ✔ 
$ git cherry-pick fix_unit_tests
[fix_hang_but_not_test c36c3ff] Fix host_test so it will not hang if the SSH connection fails
 Date: Tue Jun 13 22:57:32 2017 -0700
 1 file changed, 3 insertions(+)

 23:08:41  ograff@Olivers-MacBook-Air  ...github.com/shazow/ssh-chat   fix_hang_but_not_test ✔ 
$ go test -v
=== RUN   TestAuthWhitelist
--- PASS: TestAuthWhitelist (0.01s)
=== RUN   TestHostGetPrompt
--- PASS: TestHostGetPrompt (0.00s)
=== RUN   TestHostNameCollision
--- FAIL: TestHostNameCollision (0.01s)
	host_test.go:101: ssh: must specify HostKeyCallback
	host_test.go:124: ssh: must specify HostKeyCallback
=== RUN   TestHostWhitelist
--- FAIL: TestHostWhitelist (0.01s)
	host_test.go:152: ssh: must specify HostKeyCallback
=== RUN   TestHostKick
--- FAIL: TestHostKick (0.01s)
	host_test.go:224: ssh: must specify HostKeyCallback
FAIL
exit status 1
FAIL	github.com/shazow/ssh-chat	0.055s

 23:08:45  ✘  ograff@Olivers-MacBook-Air  ...github.com/shazow/ssh-chat   fix_hang_but_not_test ✔ 
$```

@shazow
Copy link
Copy Markdown
Owner

shazow commented Jun 14, 2017

👏 <standing ovation> 👏

Thank you @ograff ❤️ ✨ 🍮

@shazow shazow merged commit 05597b3 into shazow:master Jun 14, 2017
@ograff
Copy link
Copy Markdown
Contributor Author

ograff commented Jun 15, 2017

My pleasure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants