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

[receiver/prometheusremotewrite] flaky test #37563

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

perebaj
Copy link
Contributor

@perebaj perebaj commented Jan 29, 2025

Description

Using httptest package instead of starting a real server avoiding port conflicts.

Link to tracking issue

Fixes #36654

@perebaj perebaj changed the title receiver/prometheusremotewrite flaky test [receiver/prometheusremotewrite] flaky test Jan 29, 2025
Comment on lines 147 to 150
req := httptest.NewRequest(http.MethodPost, "/api/v1/write", bytes.NewBuffer(compressedBody))
req.Header.Set("Content-Encoding", "snappy")
req.Header.Set("Content-Type", "")
w := httptest.NewRecorder()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ArthurSens It's not done yet. It's just an idea. Did you see any problem to use httptest instead of call setupServer? Like you did here ⬇️

func TestHandlePRWContentTypeNegotiation(t *testing.T) {
setupServer(t)

httptest take care of a bunch of things. Including the creation of a valid base url and ports. For that specific case where we are just validating the expected statusCode given a header, I think that would be a good approach to avoid the flaky test thing. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pjanotti some constraint about this approach?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I like your approach! Let's do it!

@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.
Copy link
Member

@ArthurSens ArthurSens Jan 29, 2025

Choose a reason for hiding this comment

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

I know I asked you to add this changelog entry, but I think the correct option is to add the skip changelog label since the change isn't related to the collector user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I remove it, then?

Copy link
Member

Choose a reason for hiding this comment

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

yes please

@ArthurSens
Copy link
Member

/label "Skip Changelog"

not sure if this will work, let's see

@perebaj
Copy link
Contributor Author

perebaj commented Jan 29, 2025

/label "Skip Changelog"

not sure if this will work, let's see

I think that you need to set this label

image

@perebaj
Copy link
Contributor Author

perebaj commented Jan 29, 2025

/label "Skip Changelog"
not sure if this will work, let's see

I think that you need to set this label

image

I dont have permission 🙃

@ArthurSens
Copy link
Member

Yeah, I don't have it either; we need to wait for an approver/maintainer. All that's left to do here is remove the draft :)

@dashpole dashpole added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 29, 2025
@perebaj perebaj marked this pull request as ready for review January 29, 2025 19:01
@perebaj perebaj requested a review from a team as a code owner January 29, 2025 19:01
@songy23 songy23 added the Run Windows Enable running windows test on a PR label Jan 29, 2025
@pjanotti pjanotti removed the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 29, 2025
@songy23 songy23 added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/prometheusremotewrite Run Windows Enable running windows test on a PR Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[receiver/prometheusremotewrite] Flaky test
6 participants