Skip to content

Commit

Permalink
changes after the PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
medmes committed Dec 3, 2024
1 parent eff3b4b commit 049e035
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions internal/service/templategenerator/templategenerator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func TestGenerateModuleTemplateWithManagerWithoutNamespace_Success(t *testing.T)
require.Equal(t, 1, strings.Count(mockFS.writtenTemplate, "namespace"))
}

func TestGenerateModuleTemplateWithMandatoryIsTrueItShouldAddModuleLabelToTrue_Success(t *testing.T) {
func TestGenerateModuleTemplateWithMandatoryTrue_Success(t *testing.T) {
mockFS := &mockFileSystem{}
svc, _ := templategenerator.NewService(mockFS)

Expand Down Expand Up @@ -232,11 +232,12 @@ func TestGenerateModuleTemplateWithMandatoryIsTrueItShouldAddModuleLabelToTrue_S
require.Contains(t, mockFS.writtenTemplate, "rawManifest")
require.Contains(t, mockFS.writtenTemplate,
"https://github.com/kyma-project/template-operator/releases/download/1.0.1/template-operator.yaml")
require.Contains(t, mockFS.writtenTemplate, "mandatory: true")
require.Contains(t, mockFS.writtenTemplate,
"\"operator.kyma-project.io/mandatory-module\": \"true\"")
}

func TestGenerateModuleTemplateWithMandatoryIsFalseItShouldNotAddModuleLabelToTrue_Success(t *testing.T) {
func TestGenerateModuleTemplateWithMandatoryFalse_Success(t *testing.T) {
mockFS := &mockFileSystem{}
svc, _ := templategenerator.NewService(mockFS)

Expand Down
7 changes: 5 additions & 2 deletions tests/e2e/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,11 @@ var _ = Describe("Test 'create' command", Ordered, func() {
Expect(github.Type).To(Equal(githubAccessSpec.Type))
Expect(githubAccessSpec.RepoURL).To(Equal("https://github.com/kyma-project/template-operator"))

By("And spec.mandatory should be false")
By("And module template should not marked as mandatory")
Expect(template.Spec.Mandatory).To(BeFalse())
val, ok := template.Labels[shared.IsMandatoryModule]
Expect(val).To(BeEmpty())
Expect(ok).To(BeFalse())

By("And spec.associatedResources should be empty")
Expect(template.Spec.AssociatedResources).To(BeEmpty())
Expand Down Expand Up @@ -599,7 +602,7 @@ var _ = Describe("Test 'create' command", Ordered, func() {
Expect(template.Spec.ModuleName).To(Equal("template-operator"))
Expect(template.Spec.Version).To(Equal("1.0.4"))

By("And spec.mandatory should be true")
By("And module template should be marked as mandatory")
Expect(template.Spec.Mandatory).To(BeTrue())
Expect(template.Labels[shared.IsMandatoryModule]).To(Equal("true"))
})
Expand Down

0 comments on commit 049e035

Please sign in to comment.