Skip to content

Commit

Permalink
Merge pull request #2066 from AkashKanni/idp
Browse files Browse the repository at this point in the history
SDA-4924 | test: automated id:53031 Validation for Create/Delete the …
  • Loading branch information
openshift-merge-bot[bot] authored May 21, 2024
2 parents 22bdd1c + 1988fe6 commit a455467
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions tests/e2e/test_rosacli_idp.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,68 @@ var _ = Describe("Edit IDP",
Expect(idpTab.Idp(v).AuthURL).To(Equal(""))
}
})

It("Validation for Create/Delete the HTPasswd IDPs by the rosacli command - [id:53031]",
labels.Critical,
func() {
var (
idpType = "htpasswd"
idpNames = []string{"htpasswdn1", "htpasswdn2", "htpasswd3"}
validUserName = "user1"
validUserPasswd = "Pass1@htpasswd"
invalidUserName = "user:2"
)

By("Create one htpasswd idp with single user")
_, validUserName, validUserPasswd, err := common.GenerateHtpasswdPair(validUserName, validUserPasswd)
Expect(err).To(BeNil())
output, err := idpService.CreateIDP(
clusterID, idpNames[0],
"--type", idpType,
"--username", validUserName,
"--password", validUserPasswd,
"-y")
Expect(err).To(BeNil())
textData := rosaClient.Parser.TextData.Input(output).Parse().Tip()
Expect(textData).Should(ContainSubstring("Identity Provider '%s' has been created", idpNames[0]))
Expect(textData).Should(ContainSubstring("To log in to the console, open"))
Expect(textData).Should(ContainSubstring("and click on '%s'", idpNames[0]))

By("Try to create another htpasswd idp with single user")
_, validUserName, validUserPasswd, err = common.GenerateHtpasswdPair(validUserName, validUserPasswd)
Expect(err).To(BeNil())
output, err = idpService.CreateIDP(
clusterID, idpNames[1],
"--type", idpType,
"--username", validUserName,
"--password", validUserPasswd,
"-y")
Expect(err).To(BeNil())
textData = rosaClient.Parser.TextData.Input(output).Parse().Tip()
Expect(textData).Should(ContainSubstring("Identity Provider '%s' has been created", idpNames[1]))
Expect(textData).Should(ContainSubstring("To log in to the console, open"))
Expect(textData).Should(ContainSubstring("and click on '%s'", idpNames[1]))

By("Delete htpasswd idp")
output, err = idpService.DeleteIDP(
clusterID,
idpNames[0],
)
Expect(err).To(BeNil())
textData = rosaClient.Parser.TextData.Input(output).Parse().Tip()
Expect(textData).Should(ContainSubstring("Successfully deleted identity provider '%s' from cluster '%s'", idpNames[0], clusterID))

By("Try to create htpasswd idp with invalid username")
output, err = idpService.CreateIDP(
clusterID, idpNames[2],
"--type", idpType,
"--username", invalidUserName,
"--password", validUserPasswd,
"-y")
Expect(err).NotTo(BeNil())
textData = rosaClient.Parser.TextData.Input(output).Parse().Tip()
textData = strings.TrimSuffix(textData, "\n")
textData += "!(NOVERB)"
Expect(textData).Should(ContainSubstring("Failed to add IDP to cluster '%s': Invalid username '%s': Username must not contain /, :, or %", clusterID, invalidUserName))
})
})

0 comments on commit a455467

Please sign in to comment.