This repository was archived by the owner on Sep 9, 2024. It is now read-only.
mock: validate empty partition keys for all operations#87
Open
slai wants to merge 4 commits into
Open
Conversation
65cdcec to
9a0641b
Compare
The mock currently only validates empty partition keys for the Set operation, leading to unexpected success when empty partition keys are mistakenly used for Delete/Update/Read operations in tests. When testing against a real C* or Keyspaces instance, a `Key may not be empty` error will appear, code `0x2200`. This PR copies the logic used for the Set operation over to the other operations. I kept the same error message, even though it doesn't match the C* one. For clarity, note that - * a single partition key cannot be an empty string * a composite partition key can have one or all empty string values * a single or composite clustering columns can have one or all empty string values I've added tests for these for the Map and MultiMap table types, but couldn't for the MultiMapMultiKey table type because there's a bug with the implementation there that eliminates empty key values even when they're allowed by C* and Keyspaces. Changing that would change app behaviour, so I've left that as-is, with a few added comments.
a583ab7 to
8ebcaef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mock currently only validates empty partition keys for the Set operation (code), leading to unexpected success when empty partition keys are mistakenly used for Delete/Update/Read operations in tests. When testing against a real C* or Keyspaces instance, a
Key may not be emptyerror will appear, code0x2200.This PR copies the logic used for the Set operation over to the other operations. I kept the same error message, even though it doesn't match the C* one. For clarity, note that -
I've added tests for these for the Map and MultiMap table types, but couldn't for the MultiMapMultiKey table type because there's a bug with the implementation there that eliminates empty key values even when they're allowed by C* and Keyspaces. Changing that would change app behaviour, so I've left that as-is, with a few added comments.