-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Wheelmap] service rewrite and tests #2486
Conversation
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up!
// If no Wheelmap token is provided (e.g. local development), API | ||
// responses are intercepted and mocked. If a token is found, the | ||
// requests will be forwarded to the real Wheelmap service. | ||
const noToken = !serverSecrets.wheelmap_token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I'm a little nervous about is tests failing silently when there's no token. What do you think about logging a warning when there's no token? If you do it here, it'll always print because the module is always loaded, though if you put it in a before()
hook on each test, it'll only print when the tests are run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, I wasn't clear about this.
If you hook it up like this:
function logTokenWarning() {
...
}
t.create(...)
.before(logTokenWarning)
then it will only print when these service tests are actually run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, what I did is indeed run regardless of the service, I'll fix that...
Regarding tokens, how would you feel about taking care of the two test environments and staging, and I'll take care of production? The secrets get pushed from a json file on my dev machine which I can update on my own. @espadrine can fetch the latest version from the servers via git or ssh. |
I've addressed the review comments and tried adding my API key to Heroku and to the Circle CI daily and on-commit projects, however, things don't seem to be wired up correctly. Are there any additional steps needed for the new configuration to be picked up? |
Ahhh right, good question. The change to You'll need to update this line, which is what pulls the secret from the environment in the tests: Line 162 in b08a941
Heroku would need something equivalent put in place. That could be deferred if you like. Though I suppose the way to do it is adding a Added: Tests are passing locally using a real Wheelmap token. |
The tests on Circle Ci now seem to be happily running with my token! I've attempted an implementation for Heroku. However, the app is now failing to start, I'm unsure why as things seem fine when run locally. |
The best way to debug is probably using the Heroku CLI and running This is what I'm seeing:
|
That's now fixed, for some reason the logs in the Heroku UI were not as verbose as the ones you posted. I wanted to test this in the review app and set the token environement variable in shields-staging. I thought it would be propagated to newly deployed review apps as shields-staging is labelled as the "parent app". However, this does not seem to be the case. There ins't anything relevant in the pipeline settings either. Do you know if it's even possible to set that environment variable for all apps without having to specify it in app.json? |
The difference is the logs in the UI are for the build. The ones from heroku logs are for runtime. There’s a way to specify in app.json that an env var should inherit from the parent app. You don’t have to specify it explicitly. I’m on mobile so I don’t have the docs at my fingertips. |
Thanks for pointing that out, I found the relevant part of the documentation after some additional digging. Unfortunately, the main section I was previously looking at did not mention anything about that. I'll give it a go. |
Fixes issue #2469 and benefits from new functionnality in icedfrisby-nock!
Before we can deploy this, we have to coordinate on adding the API token to the production server, and optionally on Circle CI.
Looking forward to feedback! 👍