Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: d-kuro <kurosawa7620@gmail.com>
  • Loading branch information
d-kuro committed Oct 25, 2023
1 parent 2450ca4 commit 2025656
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/kubectl-moco/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func stopClustering(ctx context.Context, name string) error {

orig := cluster.DeepCopy()

if cluster.Annotations == nil {
cluster.Annotations = make(map[string]string)
}
cluster.Annotations[constants.AnnClusteringStopped] = "true"

if equality.Semantic.DeepEqual(orig, cluster) {
Expand Down Expand Up @@ -79,6 +82,9 @@ func stopReconciliation(ctx context.Context, name string) error {

orig := cluster.DeepCopy()

if cluster.Annotations == nil {
cluster.Annotations = make(map[string]string)
}
cluster.Annotations[constants.AnnReconciliationStopped] = "true"

if equality.Semantic.DeepEqual(orig, cluster) {
Expand Down
6 changes: 6 additions & 0 deletions controllers/mysqlcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1929,6 +1929,9 @@ var _ = Describe("MySQLCluster reconciler", func() {
Expect(err).NotTo(HaveOccurred())

By("setting reconcile stop annotation")
if cluster.Annotations == nil {
cluster.Annotations = map[string]string{}
}
cluster.Annotations[constants.AnnReconciliationStopped] = "true"
err = k8sClient.Update(ctx, cluster)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -1956,6 +1959,9 @@ var _ = Describe("MySQLCluster reconciler", func() {
Expect(err).NotTo(HaveOccurred())

By("setting clustering stop annotation")
if cluster.Annotations == nil {
cluster.Annotations = map[string]string{}
}
cluster.Annotations[constants.AnnClusteringStopped] = "true"
err = k8sClient.Update(ctx, cluster)
Expect(err).NotTo(HaveOccurred())
Expand Down

0 comments on commit 2025656

Please sign in to comment.