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 unit tests #3517

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Add unit tests #3517

merged 1 commit into from
Jan 4, 2024

Conversation

nilskch
Copy link
Contributor

@nilskch nilskch commented Dec 23, 2023

What?

I added some unit tests

Why?

Hi, thank you very much for this awesome tool! I am using it for quite some time now and LOVE it. I was looking through the code base and I like it a lot and wanted to contribute some tests.

honest_work

I will eventually contribute more in the future!

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass. (does fail locally but my tests pass)
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

@nilskch nilskch requested a review from a team as a code owner December 23, 2023 20:44
@nilskch nilskch requested review from codebien and joanlopez and removed request for a team December 23, 2023 20:44
joanlopez
joanlopez previously approved these changes Dec 27, 2023
Copy link
Contributor

@joanlopez joanlopez left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @nilskch! I guess these bits are probably somehow covered by other tests, but I do think these shouldn't hurt, and increasing the coverage is generally positive rather than negative. Ah, it's definitely a good opportunity for you to start contributing to k6, so welcome! 👍🏻

@codecov-commenter
Copy link

codecov-commenter commented Dec 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7d131d6) 72.48% compared to head (bfbbe6c) 72.51%.

❗ Current head bfbbe6c differs from pull request most recent head 509c293. Consider uploading reports for the commit 509c293 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3517      +/-   ##
==========================================
+ Coverage   72.48%   72.51%   +0.02%     
==========================================
  Files         276      274       -2     
  Lines       20842    20837       -5     
==========================================
+ Hits        15108    15109       +1     
+ Misses       4771     4762       -9     
- Partials      963      966       +3     
Flag Coverage Δ
ubuntu 72.51% <ø> (+0.06%) ⬆️
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nilskch
Copy link
Contributor Author

nilskch commented Dec 28, 2023

@joanlopez, thank you very much! What do we do about the failing tests? I do not think they are related to my contribution.

EDIT: now they all pass

@joanlopez
Copy link
Contributor

@joanlopez, thank you very much! What do we do about the failing tests? I do not think they are related to my contribution.

EDIT: now they all pass

Yeah, I guess there's some flakiness. I re-ran the failed jobs twice and it end up working.
Definitely not related with your contribution!

Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

Hey @nilskch.
thanks for your contribution 🙇

Added some request changes.

cloudapi/errors_test.go Outdated Show resolved Hide resolved
cloudapi/errors_test.go Outdated Show resolved Hide resolved
cloudapi/errors_test.go Outdated Show resolved Hide resolved
msg1 := "some message"
msg2 := "some other message"

// this payload struct covers all edge cases that have not been covered before
Copy link
Contributor

Choose a reason for hiding this comment

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

that have not been covered before

What do you mean? It sounds like you're referring to some other tests then we should keep this new one close to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment is confusing and I will remove it. This function was called somewhere else but it was not gracefully tested with all edge cases.

@nilskch
Copy link
Contributor Author

nilskch commented Jan 4, 2024

@codebien, I added your suggestions and squashed the commits.

@codebien codebien requested review from joanlopez and removed request for oleiade January 4, 2024 14:49
@joanlopez joanlopez merged commit fce69f0 into grafana:master Jan 4, 2024
21 checks passed
@olegbespalov olegbespalov added this to the v0.49.0 milestone Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants