Skip to content

Commit

Permalink
[#159864361] Reduce SSH tests flakiness
Browse files Browse the repository at this point in the history
- Push a single app instance for all tests. Scale to two instaces for
  tests that require it.
- Windows and linux local port forwarding tests use different local
  ports.

Signed-off-by: Sebastian Vidrio <svidrio@pivotal.io>
  • Loading branch information
Iryna Shustava authored and vitreuz committed Aug 20, 2018
1 parent ac91d20 commit a207482
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ var _ = SshDescribe("SSH", func() {
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Catnip,
"-c", "./catnip",
"-d", Config.GetAppsDomain(),
"-i", "2"),
"-d", Config.GetAppsDomain()),
Config.CfPushTimeoutDuration(),
).Should(Exit(0))
})
Expand All @@ -47,6 +46,10 @@ var _ = SshDescribe("SSH", func() {

Describe("ssh", func() {
Context("with multiple instances", func() {
BeforeEach(func() {
Eventually(cf.Cf("scale", appName, "-i", "2")).Should(Exit(0))
})

It("can ssh to the second instance", func() {
// sometimes ssh'ing to the second instance fails because the instance isn't running
// so we try a few times
Expand Down
6 changes: 3 additions & 3 deletions windows/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/logs"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/skip_messages"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/skip_messages"
)

var _ = WindowsDescribe("SSH", func() {
Expand Down Expand Up @@ -141,7 +141,7 @@ var _ = WindowsDescribe("SSH", func() {
})

It("allows local port forwarding", func() {
listenCmd := exec.Command("cf", "ssh", "-v", "-L", "127.0.0.1:61007:127.0.0.1:8080", appName)
listenCmd := exec.Command("cf", "ssh", "-v", "-L", "127.0.0.1:61009:127.0.0.1:8080", appName)

stdin, err := listenCmd.StdinPipe()
Expect(err).NotTo(HaveOccurred())
Expand All @@ -150,7 +150,7 @@ var _ = WindowsDescribe("SSH", func() {
Expect(err).NotTo(HaveOccurred())

Eventually(func() string {
curl := helpers.Curl(Config, "http://127.0.0.1:61007/").Wait(Config.CfPushTimeoutDuration())
curl := helpers.Curl(Config, "http://127.0.0.1:61009/").Wait(Config.CfPushTimeoutDuration())
return string(curl.Out.Contents())
}, Config.CfPushTimeoutDuration()).Should(ContainSubstring("hello i am nora"))

Expand Down

0 comments on commit a207482

Please sign in to comment.