Skip to content

Commit

Permalink
Make integration tests less fragile
Browse files Browse the repository at this point in the history
This commit makes the lack of authentication credentials in integration
tests more specific, such that they can be run on a machine that
has environment variables set. Additionally, it changes some regexes
that match only timezones with 3 characters to match against 4.

[#165723266]

Co-authored-by: Florent Flament <fflament@pivotal.io>
  • Loading branch information
williammartin and Florent Flament committed May 3, 2019
1 parent 5010c00 commit 557d4c2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
13 changes: 11 additions & 2 deletions integration/shared/isolated/auth_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ var _ = Describe("auth command", func() {
When("no positional arguments are provided", func() {
Context("and no env variables are provided", func() {
It("errors-out with the help information", func() {
session := helpers.CF("auth")
envWithoutLoginInfo := map[string]string{
"CF_USERNAME": "",
"CF_PASSWORD": "",
}
session := helpers.CFWithEnv(envWithoutLoginInfo, "auth")
Eventually(session.Err).Should(Say("Username and password not provided."))
Eventually(session).Should(Say("NAME:"))

Expand Down Expand Up @@ -82,7 +86,11 @@ var _ = Describe("auth command", func() {

When("only a username is provided", func() {
It("errors-out with a password required error and the help information", func() {
session := helpers.CF("auth", "some-user")
envWithoutLoginInfo := map[string]string{
"CF_USERNAME": "",
"CF_PASSWORD": "",
}
session := helpers.CFWithEnv(envWithoutLoginInfo, "auth", "some-user")
Eventually(session.Err).Should(Say("Password not provided."))
Eventually(session).Should(Say("NAME:"))

Expand All @@ -93,6 +101,7 @@ var _ = Describe("auth command", func() {
When("only a password is provided", func() {
It("errors-out with a username required error and the help information", func() {
env := map[string]string{
"CF_USERNAME": "",
"CF_PASSWORD": "some-pass",
}
session := helpers.CFWithEnv(env, "auth")
Expand Down
2 changes: 1 addition & 1 deletion integration/shared/isolated/restage_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ applications:
Eventually(session).Should(Say(`name:\s+%s`, appName))
Eventually(session).Should(Say(`requested state:\s+started`))
Eventually(session).Should(Say(`routes:\s+%s\.%s`, appName, domainName))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3,4} \d{4}`))
Eventually(session).Should(Say(`stack:\s+cflinuxfs`))
Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
Eventually(session).Should(Say(`type:\s+web`))
Expand Down
2 changes: 1 addition & 1 deletion integration/shared/isolated/restart_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ applications:
Eventually(session).Should(Say(`name:\s+%s`, appName))
Eventually(session).Should(Say(`requested state:\s+started`))
Eventually(session).Should(Say(`routes:\s+%s\.%s`, appName, domainName))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3,4} \d{4}`))
Eventually(session).Should(Say(`stack:\s+cflinuxfs`))
Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
Eventually(session).Should(Say(`type:\s+web`))
Expand Down
4 changes: 2 additions & 2 deletions integration/shared/isolated/start_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ applications:
Eventually(session).Should(Say(`name:\s+%s`, appName))
Eventually(session).Should(Say(`requested state:\s+started`))
Eventually(session).Should(Say(`routes:\s+%s\.%s`, appName, domainName))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3,4} \d{4}`))
Eventually(session).Should(Say(`stack:\s+cflinuxfs`))
Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
Eventually(session).Should(Say(`type:\s+web`))
Expand Down Expand Up @@ -222,7 +222,7 @@ applications:
Eventually(session).Should(Say(`name:\s+%s`, appName))
Eventually(session).Should(Say(`requested state:\s+started`))
Eventually(session).Should(Say(`routes:\s+%s\.%s`, appName, domainName))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3,4} \d{4}`))
Eventually(session).Should(Say(`stack:\s+cflinuxfs`))
Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
Eventually(session).Should(Say(`type:\s+web`))
Expand Down
2 changes: 1 addition & 1 deletion integration/v6/isolated/app_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ applications:
Eventually(session).Should(Say("name:\\s+%s", appName))
Eventually(session).Should(Say("requested state:\\s+started"))
Eventually(session).Should(Say("routes:\\s+%s\\.%s", appName, domainName))
Eventually(session).Should(Say("last uploaded:\\s+\\w{3} \\d{1,2} \\w{3} \\d{2}:\\d{2}:\\d{2} \\w{3} \\d{4}"))
Eventually(session).Should(Say("last uploaded:\\s+\\w{3} \\d{1,2} \\w{3} \\d{2}:\\d{2}:\\d{2} \\w{3,4} \\d{4}"))
Eventually(session).Should(Say("stack:\\s+cflinuxfs"))
Eventually(session).Should(Say("buildpacks:\\s+staticfile"))
Eventually(session).Should(Say("type:\\s+web"))
Expand Down

0 comments on commit 557d4c2

Please sign in to comment.