Skip to content

Commit

Permalink
Merge pull request #64 from guillaumerose/main
Browse files Browse the repository at this point in the history
Check error is not nil before calling a function on it
  • Loading branch information
guillaumerose authored Oct 13, 2021
2 parents 5bb8d0e + 0dd605f commit 3f884db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/port_forwarding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var _ = Describe("port forwarding", func() {
}()

_, err = net.Dial("tcp", "127.0.0.1:9090")
Expect(err).Should(HaveOccurred())
Expect(err.Error()).To(HaveSuffix("connection refused"))

Expect(client.Expose(&types.ExposeRequest{
Expand All @@ -73,6 +74,7 @@ var _ = Describe("port forwarding", func() {

Eventually(func(g Gomega) {
_, err = net.Dial("tcp", "127.0.0.1:9090")
g.Expect(err).Should(HaveOccurred())
g.Expect(err.Error()).To(HaveSuffix("connection refused"))
}).Should(Succeed())
})
Expand Down Expand Up @@ -151,6 +153,7 @@ address=/foobar/1.2.3.4
}()

_, err = net.Dial("tcp", "127.0.0.1:9090")
Expect(err).Should(HaveOccurred())
Expect(err.Error()).To(HaveSuffix("connection refused"))

_, err = sshExec(`curl http://gateway.containers.internal/services/forwarder/expose -X POST -d'{"local":":9090", "remote":":8080"}'`)
Expand All @@ -167,6 +170,7 @@ address=/foobar/1.2.3.4

Eventually(func(g Gomega) {
_, err = net.Dial("tcp", "127.0.0.1:9090")
g.Expect(err).Should(HaveOccurred())
g.Expect(err.Error()).To(HaveSuffix("connection refused"))
}).Should(Succeed())
})
Expand Down

0 comments on commit 3f884db

Please sign in to comment.