Skip to content

chore(test): improve test coverage #136

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

Merged
merged 12 commits into from
May 12, 2025
Merged

Conversation

Rolv-Apneseth
Copy link
Collaborator

Continuing work on #117

Sorry, I've been away for a while, but here is a quick PR trying to improve the test coverage. I included those 2 tests from #91.

Happy to add more tests if you have suggestions.

I've also gone ahead and broken up api/check.rs into multiple files since it was over 1k lines long (all imports should be the same though).

@Rolv-Apneseth
Copy link
Collaborator Author

Rolv-Apneseth commented Apr 30, 2025

On a side-note, I've noticed that it's not possible to create an api::Client with custom hostname and port, since those fields are private. What do you think of adding some builder methods to allow modifying an api::Client? Or do you prefer a constructor where all the fields need to be specified?

And how about a ping method on api::Client as well? It already exists for the CLI, but it seems useful to have for both.

Copy link

codspeed-hq bot commented Apr 30, 2025

CodSpeed Performance Report

Merging #136 will not alter performance

Comparing Rolv-Apneseth:test_coverage (cac026d) with v3 (ea24862)

Summary

✅ 6 untouched benchmarks

Copy link
Owner

@jeertmans jeertmans left a comment

Choose a reason for hiding this comment

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

Hi @Rolv-Apneseth, thanks for your PR and the late review, I missed the notification.

On a side-note, I've noticed that it's not possible to create an api::Client with custom hostname and port, since those fields are private. What do you think of adding some builder methods to allow modifying an api::Client? Or do you prefer a constructor where all the fields need to be specified?

Good remark! I don't even remember if there was a good reason for this or not... I'd say it makes sense to include a way to create the api::Clien with something else than default(). We don't really use a builder-like pattern in the library, so I'd rather go for something similar to api::server::ServerClient.

Maybe I am recently getting too distracted from this project, but in fact api::Client doesn't seem to be used, and is a simplified version of api::ServerClient, and does not exist on the main branch. Maybe something happened when refactoring the library.

@Rolv-Apneseth
Copy link
Collaborator Author

Maybe I am recently getting too distracted from this project, but in fact api::Client doesn't seem to be used, and is a simplified version of api::ServerClient, and does not exist on the main branch. Maybe something happened when refactoring the library.

To my knowledge, it's been like that since I came into the mix, so I've left them as separate. Want me to just remove it altogether? The example in the readme also just uses the ServerClient. Though it would be nice to have a way to define the hostname and port for that one too (without needing to use env vars).

@jeertmans
Copy link
Owner

Maybe I am recently getting too distracted from this project, but in fact api::Client doesn't seem to be used, and is a simplified version of api::ServerClient, and does not exist on the main branch. Maybe something happened when refactoring the library.

To my knowledge, it's been like that since I came into the mix, so I've left them as separate. Want me to just remove it altogether? The example in the readme also just uses the ServerClient. Though it would be nice to have a way to define the hostname and port for that one too (without needing to use env vars).

Yeah, but this is probably remanent from some in-progress work that never got reviewed well enough by me...

@Rolv-Apneseth
Copy link
Collaborator Author

Yeah, but this is probably remanent from some in-progress work that never got reviewed well enough by me...

Fair enough, leave it for now then?

@jeertmans
Copy link
Owner

Yeah, but this is probably remanent from some in-progress work that never got reviewed well enough by me...

Fair enough, leave it for now then?

I'd rather delete it, and add it back in the future if we really need it, otherwise the same "issue" will occur in the future, and we will likely not know why it's there.

@Rolv-Apneseth
Copy link
Collaborator Author

I'd rather delete it, and add it back in the future if we really need it

Removed that now. Also added a couple more tests, but let me know if you want anything else

@Rolv-Apneseth
Copy link
Collaborator Author

By the way, the last of the failing pre-commit tests for that lint code task is codepsell, not sure what you want to do about it:

 codespell................................................................Failed
- hook id: codespell
- exit code: 65

CHANGELOG.md:318: controler ==> controller
README.md:81: smal ==> small
README.md:81: smal ==> small
README.md:98: smal ==> small
README.md:98: smal ==> small
README.md:164: smal ==> small
README.md:164: smal ==> small

@jeertmans
Copy link
Owner

By the way, the last of the failing pre-commit tests for that lint code task is codepsell, not sure what you want to do about it:

 codespell................................................................Failed
- hook id: codespell
- exit code: 65

CHANGELOG.md:318: controler ==> controller
README.md:81: smal ==> small
README.md:81: smal ==> small
README.md:98: smal ==> small
README.md:98: smal ==> small
README.md:164: smal ==> small
README.md:164: smal ==> small

We can probably use inline ignore instructions, see here https://github.com/codespell-project/codespell?tab=readme-ov-file#inline-ignore.

What do you think?

@Rolv-Apneseth
Copy link
Collaborator Author

Rolv-Apneseth commented May 11, 2025

By the way, the last of the failing pre-commit tests for that lint code task is codepsell, not sure what you want to do about it:

 codespell................................................................Failed
- hook id: codespell
- exit code: 65

CHANGELOG.md:318: controler ==> controller
README.md:81: smal ==> small
README.md:81: smal ==> small
README.md:98: smal ==> small
README.md:98: smal ==> small
README.md:164: smal ==> small
README.md:164: smal ==> small

We can probably use inline ignore instructions, see here https://github.com/codespell-project/codespell?tab=readme-ov-file#inline-ignore.

What do you think?

Not sure how to do comments in Markdown but I can look into it when I have a moment

Edit: can probably just use html comments but yeah I'll see how it works for codespell

@Rolv-Apneseth
Copy link
Collaborator Author

Looks like that worked.

This one OK to merge?

Copy link
Owner

@jeertmans jeertmans left a comment

Choose a reason for hiding this comment

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

Looks great, thank you so much @Rolv-Apneseth!!

@jeertmans jeertmans merged commit 7e100c8 into jeertmans:v3 May 12, 2025
24 of 25 checks passed
@jeertmans jeertmans added the ci Continuous Integration related (GitHub actions, precommit, …) label May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration related (GitHub actions, precommit, …)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants