Skip to content

Commit

Permalink
fix stateful rsm block in updating phase
Browse files Browse the repository at this point in the history
  • Loading branch information
free6om committed Sep 14, 2023
1 parent 13be616 commit 259cef8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/controller/rsm/transformer_member_reconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func (t *MemberReconfigurationTransformer) Transform(ctx graph.TransformContext,
}
rsm := transCtx.rsm

if len(rsm.Spec.Roles) == 0 || rsm.Spec.RoleProbe == nil {
return nil
}

// handle cluster initialization
// set initReplicas at creation
if rsm.Status.InitReplicas == 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ var _ = Describe("member reconfiguration transformer test.", func() {
transformer = &MemberReconfigurationTransformer{}
})

Context("cluster initialization", func() {
Context("roleful cluster initialization", func() {
It("should initialize well", func() {
By("initialReplicas=0")
Expect(transformer.Transform(transCtx, dag)).Should(Succeed())
Expand All @@ -149,6 +149,16 @@ var _ = Describe("member reconfiguration transformer test.", func() {
})
})

Context("stateful cluster initialization", func() {
It("should work well", func() {
By("set spec.roles to nil")
rsm.Spec.Roles = nil
Expect(transformer.Transform(transCtx, dag)).Should(Succeed())
Expect(rsm.Status.InitReplicas).Should(BeEquivalentTo(0))
Expect(rsm.Status.ReadyInitReplicas).Should(BeEquivalentTo(0))
})
})

Context("scale-out", func() {
It("should work well", func() {
By("make rsm ready for scale-out")
Expand Down

0 comments on commit 259cef8

Please sign in to comment.