Skip to content

Commit

Permalink
chore: add ut
Browse files Browse the repository at this point in the history
  • Loading branch information
sophon-zt committed Jun 1, 2023
1 parent bac43b8 commit ab458a0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions internal/controller/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,22 @@ var _ = Describe("builder", func() {
Expect(configmap).ShouldNot(BeNil())
})

It("builds config manager sidecar container correctly", func() {
sidecarRenderedParam := &cfgcm.CfgManagerBuildParams{
ManagerName: "cfgmgr",
CharacterType: "mysql",
SecreteName: "test-secret",
Image: constant.KBToolsImage,
Args: []string{},
Envs: []corev1.EnvVar{},
Volumes: []corev1.VolumeMount{},
}
configmap, err := BuildCfgManagerContainer(sidecarRenderedParam)
Expect(err).Should(BeNil())
Expect(configmap).ShouldNot(BeNil())
Expect(configmap.SecurityContext).Should(BeNil())
})

It("builds config manager sidecar container correctly", func() {
sidecarRenderedParam := &cfgcm.CfgManagerBuildParams{
ManagerName: "cfgmgr",
Expand All @@ -466,6 +482,9 @@ var _ = Describe("builder", func() {
configmap, err := BuildCfgManagerContainer(sidecarRenderedParam)
Expect(err).Should(BeNil())
Expect(configmap).ShouldNot(BeNil())
Expect(configmap.SecurityContext).ShouldNot(BeNil())
Expect(configmap.SecurityContext.RunAsUser).ShouldNot(BeNil())
Expect(*configmap.SecurityContext.RunAsUser).Should(BeEquivalentTo(int64(0)))
})
})

Expand Down

0 comments on commit ab458a0

Please sign in to comment.