Skip to content

Commit

Permalink
Fix E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmabadr committed Sep 24, 2024
1 parent 08d6491 commit 84b2ca3
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions tests/e2e/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,21 @@ var _ = Describe("Test 'create' command", Ordered, func() {
invalidModuleConfigFile := "./testdata/module-config-missing-required.yaml"

templateOutputPath := "/tmp/template.yaml"

Context("Given 'modulectl create' command", func() {
var cmd createCmd
It("When invoked without any args", func() {
cmd = createCmd{}
})

It("Then the command should fail", func() {
err := cmd.execute()
Expect(err).Should(HaveOccurred())
Expect(err.Error()).Should(ContainSubstring("Error: \"--module-config-file\" flag is required"))
})
})
gitRemote := "https://github.com/kyma-project/template-operator"

// test should be removed: module-config-file has the default value of module-config.yaml
// Context("Given 'modulectl create' command", func() {
// var cmd createCmd
// It("When invoked without any args", func() {
// cmd = createCmd{}
// })
//
// It("Then the command should fail", func() {
// err := cmd.execute()
// Expect(err).Should(HaveOccurred())
// Expect(err.Error()).Should(ContainSubstring("Error: \"--module-config-file\" flag is required"))
// })
// })

Context("Given 'modulectl create' command", func() {
var cmd createCmd
Expand All @@ -81,7 +83,7 @@ var _ = Describe("Test 'create' command", Ordered, func() {
It("Then the command should fail", func() {
err := cmd.execute()
Expect(err).Should(HaveOccurred())
Expect(err.Error()).Should(ContainSubstring("Error: field is required"))
Expect(err.Error()).Should(ContainSubstring("invalid Option: opts.ModuleName must not be empty"))
})
})

Expand All @@ -108,6 +110,7 @@ var _ = Describe("Test 'create' command", Ordered, func() {
registry: ociRegistry,
insecure: true,
output: templateOutputPath,
gitRemote: gitRemote,
}
})
It("Then the command should succeed", func() {
Expand Down Expand Up @@ -136,7 +139,7 @@ var _ = Describe("Test 'create' command", Ordered, func() {
Expect(repo.Object["type"]).To(Equal(ocireg.Type))

By("And descriptor.component.resources should be correct")
Expect(descriptor.Resources).To(HaveLen(2))
Expect(descriptor.Resources).To(HaveLen(3))
resource := descriptor.Resources[0]
Expect(resource.Name).To(Equal("template-operator"))
Expect(resource.Relation).To(Equal(ocmmetav1.ExternalRelation))
Expand Down Expand Up @@ -201,7 +204,8 @@ var _ = Describe("Test 'create' command", Ordered, func() {
Expect(secScanLabels).To(HaveKeyWithValue("scan.security.kyma-project.io/language", "golang-mod"))
Expect(secScanLabels).To(HaveKeyWithValue("scan.security.kyma-project.io/dev-branch", "main"))
Expect(secScanLabels).To(HaveKeyWithValue("scan.security.kyma-project.io/subprojects", "false"))
Expect(secScanLabels).To(HaveKeyWithValue("scan.security.kyma-project.io/exclude", "**/test/**,**/*_test.go"))
Expect(secScanLabels).To(HaveKeyWithValue("scan.security.kyma-project.io/exclude",
"**/test/**,**/*_test.go"))
})
})

Expand Down

0 comments on commit 84b2ca3

Please sign in to comment.