-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add cluster size validation rule #230
Changes from 5 commits
ff406f5
0f2196a
75652ae
d815896
1709947
e0b6bec
cade3f8
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 | ||||
---|---|---|---|---|---|---|
|
@@ -267,6 +267,36 @@ func Test_Validate_UpdateNATS(t *testing.T) { | |||||
}, | ||||||
wantErrMsg: "fileStorage is immutable once it was set", | ||||||
}, | ||||||
{ | ||||||
name: `validation of cluster fails, if cluster.size>1 gets set to 1'`, | ||||||
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. This sentence is a little confusing. How about:
Suggested change
...or something similar. 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. Done! |
||||||
givenNATS: testutils.NewNATSCR( | ||||||
testutils.WithNATSCluster(defaultCluster()), | ||||||
), | ||||||
wantMatches: gomega.And( | ||||||
natsmatchers.HaveSpecCluster(defaultCluster()), | ||||||
), | ||||||
givenUpdates: []testutils.NATSOption{ | ||||||
testutils.WithNATSCluster(v1alpha1.Cluster{ | ||||||
Size: 1, | ||||||
}), | ||||||
}, | ||||||
wantErrMsg: "size cannot be reduced to 1 once it was >1", | ||||||
}, | ||||||
{ | ||||||
name: `validation of cluster passes, if cluster.size>1 gets set to >1'`, | ||||||
givenNATS: testutils.NewNATSCR( | ||||||
testutils.WithNATSCluster(defaultCluster()), | ||||||
), | ||||||
wantMatches: gomega.And( | ||||||
natsmatchers.HaveSpecCluster(defaultCluster()), | ||||||
), | ||||||
givenUpdates: []testutils.NATSOption{ | ||||||
testutils.WithNATSCluster(v1alpha1.Cluster{ | ||||||
Size: 5, | ||||||
}), | ||||||
}, | ||||||
wantErrMsg: noError, | ||||||
}, | ||||||
} | ||||||
|
||||||
for _, tc := range testCases { | ||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
message="size cannot be reduced to 1 once it was >1"
Wasn't this the other way around? Once it will be set to
1
it cannot be changed?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.
No, the rule is, once it was set to greater than
1
it can never be1
again. I can try to make the message clearer likecannot be set to 1 if size was greater than 1
?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.
Okay, looks I got that wrong. Nevermind then.