@@ -29,11 +29,16 @@ func TestServer(t *testing.T) {
2929 }
3030 cfg .AddHostKey (key )
3131
32- cxt := runServer (& cfg , t )
32+ c := NewCircuit ()
33+ cxt := runServer (& cfg , c , t )
3334
3435 // Give server time to initialize.
3536 time .Sleep (200 * time .Millisecond )
3637
38+ if c .State () != ClosedState {
39+ t .Fatalf ("circuit was not in closed state" )
40+ }
41+
3742 // Connect to the server and issue env var set. This should return true.
3843 client , err := ssh .Dial ("tcp" , testingServerAddr , & ssh.ClientConfig {})
3944 if err != nil {
@@ -77,7 +82,11 @@ func sshTestingHostKey() (ssh.Signer, error) {
7782 return ssh .ParsePrivateKey ([]byte (testingHostKey ))
7883}
7984
80- func runServer (config * ssh.ServerConfig , t * testing.T ) cookoo.Context {
85+ func sshTestingClientKey () (ssh.Signer , error ) {
86+ return ssh .ParsePrivateKey ([]byte (testingClientKey ))
87+ }
88+
89+ func runServer (config * ssh.ServerConfig , c * Circuit , t * testing.T ) cookoo.Context {
8190 reg , router , cxt := cookoo .Cookoo ()
8291 cxt .Put (ServerConfig , config )
8392 cxt .Put (Address , testingServerAddr )
@@ -99,7 +108,7 @@ func runServer(config *ssh.ServerConfig, t *testing.T) cookoo.Context {
99108 })
100109
101110 go func () {
102- if err := Serve (reg , router , cxt ); err != nil {
111+ if err := Serve (reg , router , c , cxt ); err != nil {
103112 t .Fatalf ("Failed serving with %s" , err )
104113 }
105114 }()
0 commit comments