New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CN-983] Persistence of SQL metadata shouldn't be changed once it was enabled #883
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2185,6 +2185,36 @@ var _ = Describe("Hazelcast CR", func() { | |
|
||
Expect(hz.Spec.SQL.CatalogPersistenceEnabled).Should(BeTrue()) | ||
}) | ||
|
||
It("should fail to disable catalogPersistence", Label("fast"), func() { | ||
spec := test.HazelcastSpec(defaultHazelcastSpecValues(), ee) | ||
spec.Persistence = &hazelcastv1alpha1.HazelcastPersistenceConfiguration{ | ||
BaseDir: "/data/hot-restart/", | ||
ClusterDataRecoveryPolicy: hazelcastv1alpha1.FullRecovery, | ||
Pvc: &hazelcastv1alpha1.PersistencePvcConfiguration{ | ||
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, | ||
RequestStorage: resource.NewQuantity(9*2^20, resource.BinarySI), | ||
}, | ||
} | ||
spec.SQL = &hazelcastv1alpha1.SQL{ | ||
CatalogPersistenceEnabled: true, | ||
} | ||
|
||
hzSpec, _ := json.Marshal(&spec) | ||
|
||
hz := &hazelcastv1alpha1.Hazelcast{ | ||
ObjectMeta: randomObjectMeta(namespace, n.LastSuccessfulSpecAnnotation, string(hzSpec)), | ||
Spec: spec, | ||
} | ||
|
||
Create(hz) | ||
hz = ensureHzStatusIsPending(hz) | ||
Expect(hz.Spec.SQL.CatalogPersistenceEnabled).Should(BeTrue()) | ||
|
||
hz.Spec.SQL.CatalogPersistenceEnabled = false | ||
err := k8sClient.Update(context.Background(), hz) | ||
Expect(err).Should(MatchError(ContainSubstring("field cannot be disabled after it has been enabled"))) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think we need to check for exact match of error message. I dont think we do it in other tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not? Ideally we should do it other tests too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dzeromski-hazelcast we do it in other tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would argue that putting such a specific check in test is unnecessary and makes maintaining tests harder in the long run. But up to you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would disagree. Errors are part of the public API, so in this case, we make sure to test the public API and not have a false-positive test, in case we get the |
||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest using simpler name like:
validateSQLFields
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the convention we use in the validation.
e.g: