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

Refactor tests and increase required go version to 1.18 #9

Merged
merged 3 commits into from
Jan 5, 2023

Conversation

56quarters
Copy link

  • Split large tests into multiple sub-tests
  • Add tests for per-call allocator support
  • Always run touch command tests

Signed-off-by: Nick Pillitteri nick.pillitteri@grafana.com

* Split large tests into multiple sub-tests
* Add tests for per-call allocator support
* Always run `touch` command tests

Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
@56quarters 56quarters marked this pull request as ready for review January 4, 2023 18:32
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
Copy link

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

LGTM, definitely an improvement over the current tests.

This is a suggestion for a future PR and doesn't block merging this one: testWithClient is getting quite long, and I don't love the dependencies between some of the scenarios (eg. the set and get scenarios must be run in sequence to pass) - perhaps testWithClient could be broken up into a number of self-contained test methods?

t.Run("set", func(t *testing.T) {
foo := &Item{Key: "foo", Value: []byte("fooval"), Flags: 123}
err := c.Set(foo)
checkErr(err, "first set(foo): %v", err)

Choose a reason for hiding this comment

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

Probably something for a subsequent PR: it might be nice to use github.com/stretchr/testify to make the assertions clearer and remove some of the duplication

Copy link
Author

Choose a reason for hiding this comment

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

Great idea! I'll take care of it in a follow up PR.

@56quarters
Copy link
Author

LGTM, definitely an improvement over the current tests.

This is a suggestion for a future PR and doesn't block merging this one: testWithClient is getting quite long, and I don't love the dependencies between some of the scenarios (eg. the set and get scenarios must be run in sequence to pass) - perhaps testWithClient could be broken up into a number of self-contained test methods?

I didn't even realize they depended on each other like that. I'll fix before merging this PR

@bboreham
Copy link
Collaborator

bboreham commented Jan 5, 2023

This seems to be going a long way away from the initial intention to host a fork of changes we expected to be upstreamed some day.
Maybe that is a valid change, but I think it should be explicitly considered.

Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
@56quarters
Copy link
Author

This seems to be going a long way away from the initial intention to host a fork of changes we expected to be upstreamed some day.
Maybe that is a valid change, but I think it should be explicitly considered.

I wasn't aware we were still intending to upstream these changes.

@bboreham
Copy link
Collaborator

bboreham commented Jan 5, 2023

All of the initial changes were already PRs upstream.
I think we should change the README to indicate the intention if it's different now.

@56quarters
Copy link
Author

56quarters commented Jan 5, 2023

OK, I can update the README to indicate that. We've already taken on the burden of maintaining forked Thanos caching code in Mimir and now dskit and to me this client is even simpler than that code (and seems "done" for the most part) .

@56quarters 56quarters merged commit 11f7923 into master Jan 5, 2023
@56quarters 56quarters deleted the 56quarters/test-cleanup branch January 5, 2023 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants