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 test support for port and env #1395

Merged
merged 26 commits into from
Jan 23, 2025

Conversation

vaidehiadhi
Copy link
Contributor

@vaidehiadhi vaidehiadhi commented Jan 17, 2025

Pull Request Template

Description:

  • Added a new ServerConfigsProvider function to simplify the process of generating and managing server configurations for testing.
  • The function dynamically assigns free ports for HTTP, Metrics, and gRPC services, and sets corresponding environment variables.
  • Closes issue Remove boilerplate with ports when booting the tests Remove boilerplate with ports when booting the tests #1352

Breaking Changes (if applicable):

  • None.

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

Thank you for your contribution!

pkg/gofr/testutil/port_test.go Outdated Show resolved Hide resolved
pkg/gofr/testutil/port.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

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

Thanks

@ccoVeille
Copy link
Contributor

Now the question is: once this PR will be reviewed by other maintainers and it will about to get merged.

Should you add separate commits to this PR to start using this method ?

Or should a new PR need to be added to start using it?

It's an open question. I'm fine with both

@Umang01-hash
Copy link
Contributor

Now the question is: once this PR will be reviewed by other maintainers and it will about to get merged.

Should you add separate commits to this PR to start using this method ?

Or should a new PR need to be added to start using it?

It's an open question. I'm fine with both

Hey @ccoVeille I think we can add commits in this PR only and make changes to test methods using the ports

@ccoVeille
Copy link
Contributor

I was also thinking it's the way to do, as it would be the best way to see if the code provided will work for the tests where it could be used.

But I preferred to ask 😅

examples/http-server-using-redis/main_test.go Outdated Show resolved Hide resolved
examples/using-cron-jobs/main_test.go Outdated Show resolved Hide resolved
pkg/gofr/context_test.go Outdated Show resolved Hide resolved
pkg/gofr/gofr_test.go Outdated Show resolved Hide resolved
pkg/gofr/gofr_test.go Outdated Show resolved Hide resolved
pkg/gofr/websocket_test.go Outdated Show resolved Hide resolved
@ccoVeille
Copy link
Contributor

Thank you for simplifying everything. The tests file way simpler.

I'm glad you worked on this

@vaidehiadhi
Copy link
Contributor Author

Thank you for simplifying everything. The tests file way simpler.

I'm glad you worked on this

Thank you @ccoVeille. Please do let me know if there should be anymore changes/improvements or if i have overseen or missed out on anything else.

Umang01-hash
Umang01-hash previously approved these changes Jan 21, 2025
@ccoVeille
Copy link
Contributor

This PR will conflict with mine #1426

And it's OK.

Let's merge this one, mine is in draft, and I can easily resolve everything in my PR

@Umang01-hash Umang01-hash merged commit d79d6b5 into gofr-dev:development Jan 23, 2025
12 checks passed
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.

5 participants