Skip to content

Commit

Permalink
add more testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
lindnerby committed Nov 4, 2024
1 parent 9207f2c commit 0d03363
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/e2e/create/create_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const (
missingDocumentationConfig = invalidConfigs + "missing-documentation.yaml"
missingRepositoryConfig = invalidConfigs + "missing-repository.yaml"
missingIconsConfig = invalidConfigs + "missing-icons.yaml"
nonHttpsRepository = invalidConfigs + "non-https-repository.yaml"
nonHttpsDocumentation = invalidConfigs + "non-https-documentation.yaml"
nonHttpsResource = invalidConfigs + "non-https-resource.yaml"
resourceWithoutLink = invalidConfigs + "resource-without-link.yaml"
resourceWithoutName = invalidConfigs + "resource-without-name.yaml"
Expand Down
34 changes: 31 additions & 3 deletions tests/e2e/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var _ = Describe("Test 'create' command", Ordered, func() {

Context("Given 'modulectl create' command", func() {
var cmd createCmd
It("When invoked with '--config-file' using file with missing name", func() {
It("When invoked with missing name", func() {
cmd = createCmd{
moduleConfigFile: missingNameConfig,
}
Expand All @@ -53,7 +53,7 @@ var _ = Describe("Test 'create' command", Ordered, func() {

Context("Given 'modulectl create' command", func() {
var cmd createCmd
It("When invoked with '--config-file' using file with missing version", func() {
It("When invoked with missing version", func() {
cmd = createCmd{
moduleConfigFile: missingVersionConfig,
}
Expand All @@ -67,7 +67,7 @@ var _ = Describe("Test 'create' command", Ordered, func() {

Context("Given 'modulectl create' command", func() {
var cmd createCmd
It("When invoked with '--config-file' using file with missing manifest", func() {
It("When invoked with missing manifest", func() {
cmd = createCmd{
moduleConfigFile: missingManifestConfig,
}
Expand Down Expand Up @@ -107,6 +107,34 @@ var _ = Describe("Test 'create' command", Ordered, func() {
})
})

Context("Given 'modulectl create' command", func() {
var cmd createCmd
It("When invoked with non https repository", func() {
cmd = createCmd{
moduleConfigFile: nonHttpsRepository,
}
})
It("Then the command should fail", func() {
err := cmd.execute()
Expect(err).Should(HaveOccurred())
Expect(err.Error()).Should(ContainSubstring("failed to parse module config: failed to validate module config: failed to validate repository: failed to validate link: invalid Option: 'http://github.com/kyma-project/template-operator' is not using https scheme"))
})
})

Context("Given 'modulectl create' command", func() {
var cmd createCmd
It("When invoked with non https documentation", func() {
cmd = createCmd{
moduleConfigFile: nonHttpsDocumentation,
}
})
It("Then the command should fail", func() {
err := cmd.execute()
Expect(err).Should(HaveOccurred())
Expect(err.Error()).Should(ContainSubstring("failed to parse module config: failed to validate module config: failed to validate documentation: failed to validate link: invalid Option: 'http://github.com/kyma-project/template-operator/blob/main/README.md' is not using https scheme"))
})
})

Context("Given 'modulectl create' command", func() {
var cmd createCmd
It("When invoked with missing icons", func() {
Expand Down

0 comments on commit 0d03363

Please sign in to comment.