Skip to content

Commit 1c5f21f

Browse files
authored
skip ssl validation for tests if needed (#3556)
1 parent 9664e20 commit 1c5f21f

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

integration/v7/isolated/login_command_test.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,12 @@ var _ = Describe("login command", func() {
259259
input := NewBuffer()
260260
_, err := input.Write([]byte("bad-passcode-again\nbad-passcode-strikes-back\n"))
261261
Expect(err).ToNot(HaveOccurred())
262-
session := helpers.CFWithStdin(input, "login", "--sso-passcode", "some-passcode")
262+
var session *Session
263+
if skipSSLValidation {
264+
session = helpers.CFWithStdin(input, "login", "--sso-passcode", "some-passcode", "--skip-ssl-validation")
265+
} else {
266+
session = helpers.CFWithStdin(input, "login", "--sso-passcode", "some-passcode")
267+
}
263268
Eventually(session).Should(Say("API endpoint:\\s+" + helpers.GetAPI()))
264269
Eventually(session).Should(Say(`Authenticating\.\.\.`))
265270
Eventually(session.Err).Should(Say(`Invalid passcode`))
@@ -293,7 +298,12 @@ var _ = Describe("login command", func() {
293298
When("the user provides the --origin flag", func() {
294299
It("logs in successfully", func() {
295300
username, password := helpers.GetCredentials()
296-
session := helpers.CF("login", "-u", username, "-p", password, "--origin", "uaa")
301+
var session *Session
302+
if skipSSLValidation {
303+
session = helpers.CF("login", "-u", username, "-p", password, "--origin", "uaa", "--skip-ssl-validation")
304+
} else {
305+
session = helpers.CF("login", "-u", username, "-p", password, "--origin", "uaa")
306+
}
297307
Eventually(session).Should(Say("API endpoint:\\s+" + helpers.GetAPI()))
298308
Eventually(session).Should(Say(`Authenticating\.\.\.`))
299309
Eventually(session).Should(Say(`OK`))
@@ -402,7 +412,12 @@ var _ = Describe("login command", func() {
402412
When("the user provides the -p and -u flags", func() {
403413
Context("and the credentials are correct", func() {
404414
It("logs in successfully", func() {
405-
session := helpers.CF("login", "-p", password, "-u", username)
415+
var session *Session
416+
if skipSSLValidation {
417+
session = helpers.CF("login", "-p", password, "-u", username, "--skip-ssl-validation")
418+
} else {
419+
session = helpers.CF("login", "-p", password, "-u", username)
420+
}
406421
Eventually(session).Should(Say("API endpoint:\\s+" + helpers.GetAPI()))
407422
Eventually(session).Should(Say(`Authenticating\.\.\.`))
408423
Eventually(session).Should(Say(`OK`))
@@ -567,7 +582,12 @@ var _ = Describe("login command", func() {
567582
_, err := input.Write([]byte("3\n"))
568583
Expect(err).ToNot(HaveOccurred())
569584

570-
session := helpers.CFWithStdin(input, "login", "-u", username, "-p", password)
585+
var session *Session
586+
if skipSSLValidation {
587+
session = helpers.CFWithStdin(input, "login", "-u", username, "-p", password, "--skip-ssl-validation")
588+
} else {
589+
session = helpers.CFWithStdin(input, "login", "-u", username, "-p", password)
590+
}
571591

572592
Eventually(session).Should(Say(regexp.QuoteMeta("Select an org:")))
573593
Eventually(session).Should(Say(regexp.QuoteMeta(`Org (enter to skip):`)))

0 commit comments

Comments
 (0)