Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Get FCM Root Url from Environment variable #912

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

Open
yashjain12yj wants to merge 10 commits into firebase:master
base: master
Choose a base branch
Loading
from yashjain12yj:issue-FR-802

Conversation

Copy link

@yashjain12yj yashjain12yj commented Feb 13, 2024
edited
Loading

Summary

Added functionality to override FCM root URL via Env Variable so that before constructing the FirebaseApp object we can set the Fcm root url in the environment variable. This will help in changing the base URL to localhost while writing FTs(Functional Tests)/Integration Tests.

Global Variable: GOOGLE_FCM_HOST

Open Issue: #802

How setting the base url to localhost help with your functional tests?
While writing functional tests/Integration tests, we do mock all the external services and create mock servers which behaves the same as external service. So here in case of sending push notifications, we are using Firebase admin SDK and to write tests for this use-case, we would need to mock the FCM server with a mock server created in tests.

For example
image

Here, Suppose we are writing tests for Service 1. It exposes a GET API to get some data. The data contains multiple attributes few attributes from DB, a few from the cache, and a few from Service 2(HTTP API).

While setting up the tests we will create a DB, cache server, and a mock HTTP server. Once the server is up, we want Service 1 to point to these servers instead of actual hosts. Since the DB, cache, and mock HTTP server are running in the same machine on different ports. We would want to set the Host to localhost with respective ports.

Now in the case of Firebase admin SDK, the host is hardcoded in the library. Hence, we are not able to override the Host to localhost.

lmartorella, mygreen, and martinboue reacted with thumbs up emoji
Copy link
Author

yashjain12yj commented Feb 13, 2024
edited
Loading

@kroikie @lahirumaramba Could you please review the PR?

Looks like others are also looking for the same feature. Please take a look on comment in this PR

Copy link

@kroikie @lahirumaramba, these changes will increase the testability of applications that use firebase-admin-java. My team is also currently blocked. I will be grateful for accepting this contribution from @yashjain12yj.

Copy link

@aditya-gupta-swiggy aditya-gupta-swiggy 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 raising this PR @yashjain12yj ! this is much needed for our use case as well, grateful for your contribution. can we merge this @kroikie @lahirumaramba ?

Copy link

@kroikie @lahirumaramba any updates on this?

Copy link

rashineema commented Jun 6, 2024
edited
Loading

This change will significantly improve the testability of the application. By using the admin SDK, we avoid the need to implement the HTTP v1 client and manage FCM-specific errors ourselves.

@kroikie @lahirumaramba, could you please review and merge this? It will be beneficial for everyone.

Thanks @yashjain12yj for the contribution.

Copy link

Thanks for the contribution. Any update on this PR? This is also something we need for testing purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
3 more reviewers

@rashineema rashineema rashineema approved these changes

@aditya-gupta-swiggy aditya-gupta-swiggy aditya-gupta-swiggy approved these changes

@ajax-semenov-y ajax-semenov-y ajax-semenov-y approved these changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /