Skip to content
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

test: Expand CoreKV repo testing #6

Merged
merged 24 commits into from
Jan 13, 2025

Conversation

AndrewSisley
Copy link
Collaborator

Relevant issue(s)

Resolves #13

Description

Replaces the old tests with a more formal framework that easily provides coverage for all store implementations (there are two open PRs for new implementations, so hopefully it should speed those up too), and enforces their consistency, as well as hopefully being a little easier to read.

The framework is designed to allow the bulk of the stuff to be used within bench tests, as well as integration tests.

Currently excluded from this PR are the transaction and the iterator tests, as currently the memory store does not implement the corekv interfaces there. Those tests can be sorted out in #14 .

It also fixes a minor inconsistency (bug) regarding a returned error message.

I recommend reviewing commit by commit, it should be easier to see from where tests have been moved. Some commit messages provide a little more info on the reasoning behind the changes.

Note how only one test in the suites was ever actually executed, the rest were commented out of the executing set.
TestNewDatastore was also removed, as all our tests will check this and its not really worth re-creating it IMO.
The migrate test has been changed slightly, as calling `Close` after cancelling does not IMO add any value. It loooks like it made sense when Closing a closed store errored, but that changed a while back in order to match badger behaviour.
This is a sneaky bug fix, where for this kind of error, the memory and badger implementations were returning different errors.  This is tested by a test migrated in a later commit (previously badger was untested).
Note, the two original tests are duplicates of each other as one sets the value in newLoadedDatastore and the other just sets it inline
Badger and our memory store differ here, and the badger error suggested that I should not try and tackle the difference within this PR as the error is returned for multiple reasons.
Case is already covered by already-migrated tests.
@AndrewSisley AndrewSisley added this to the CoreKV v0.1 milestone Jan 9, 2025
@AndrewSisley AndrewSisley requested a review from a team January 9, 2025 20:46
@AndrewSisley AndrewSisley self-assigned this Jan 9, 2025
Copy link
Member

@nasdf nasdf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I really like the data-oriented test framework and smart usage of it to get namespace coverage.

@AndrewSisley AndrewSisley merged commit 51f8345 into sourcenetwork:main Jan 13, 2025
@AndrewSisley AndrewSisley deleted the 3356-ckv-tests branch January 13, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand CoreKV repo testing
2 participants