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

Add more test cases for sharding strategy #160

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

TheoBrigitte
Copy link
Member

Towards: giantswarm/roadmap#3724

Adding more test cases for sharding strategy to cover more scenarios.

@TheoBrigitte TheoBrigitte requested a review from a team as a code owner November 8, 2024 14:08
@TheoBrigitte TheoBrigitte self-assigned this Nov 8, 2024
currentShardCount: 3,
timeSeries: float64(0),
expected: 3,
},
},
},
}

func TestShardComputationLogic(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove parallèl?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no need for parallel execution here

Copy link
Contributor

Choose a reason for hiding this comment

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

Well yes, improving speed 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

with t.Parallel

$ time go test ./pkg/monitoring/prometheusagent/sharding/
ok      github.com/giantswarm/observability-operator/pkg/monitoring/prometheusagent/sharding    (cached)
go test ./pkg/monitoring/prometheusagent/sharding/  0,11s user 0,05s system 192% cpu 0,084 total

without t.Parallel

$ time go test ./pkg/monitoring/prometheusagent/sharding/
ok      github.com/giantswarm/observability-operator/pkg/monitoring/prometheusagent/sharding    (cached)
go test ./pkg/monitoring/prometheusagent/sharding/  0,11s user 0,08s system 175% cpu 0,104 total

I see no speed improvement, and even then tests do not need such "optimization". t.Parallel is also meant to be used in order to spot race conditions rather than improving speed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well I disagree that tests should not run on parallel for ci costs and Time but hère they are probably not relevant

@TheoBrigitte TheoBrigitte enabled auto-merge (squash) November 8, 2024 16:00
@TheoBrigitte TheoBrigitte merged commit 1bde716 into main Nov 8, 2024
9 checks passed
@TheoBrigitte TheoBrigitte deleted the update-sharding-strategy-tests branch November 8, 2024 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
Development

Successfully merging this pull request may close these issues.

2 participants