Closed Tardog closed 6 years ago
Checks are finished. There are still a few issues.
Hey @Tardog, glad to see you again!
Google API shouldn't be hitting quota. We're well under the limits.
The tenon_api_key is in the project settings. Not sure why it's failing.
I've disabled the quote style in check Codacy. I didn't see an option to select single quotes.
Anything I can do to help?
@JulianNorton I love contributing here, so I’ll always come back when life doesn’t get in the way. :)
There is something funky going on with the tests on CircleCI. The error messages for forecast-related tests fluctuate between these two:
wxkb.io | Error: Status is OVER_QUERY_LIMIT. You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_
wxkb.io | "Forecast cannot be retrieved. Response: 403 Forbidden
Is there any way for you to see a build log with all private environment variables, to determine if they have been correctly set? It’s strange that previous builds from only two days ago pass the tests, yet now they are failing for both current PRs.
Disabling the check is, in my opinion, not a long-term solution. I’ve logged into Codacy to see if I can find something else. And I did – there’s a carefully hidden "Details" button for each setting. It only appears if you hover somewhere over the text (but NOT the checkbox):
Editing this to avoid double posting: So I’ve set up CircleCI with my fork of weather-10kb. Before adding the API keys in the app, tests failed with the same 403 error message we see in the recent builds of the main project. After I added the keys to the environment, all tests passed. Yes, even the one checking tenon.io. That still doesn’t tell us why the same setup fails on the main repo, however. :(
/second edit: On second thought, it makes perfect sense. The environment variables are set on a per-project basis. Anyone making a pull request from a fork (as opposed to using a branch on the main repository as a base) doesn’t get the environment variables set for your account at CircleCI. Thus, the tests fail until that user links their Github account with CircleCI and sets up their own API keys.
Builds pass when I run them, I think you're right about hiding the environmental variables!
Quote Style: I've re-enabled quote checks and specified single. The screenshot was a big help in finding where it was hidden.
Thanks @Tardog!
As discussed, the test uses the tenon.io API key provided by an environment variable (TENON_API_KEY). If the API key is undefined or empty, the test will be skipped – this will prevent test failures during development for contributors who don’t have a tenon.io key. For deployment, the environment must be set up to allow the tests to run.
As it turned out, the existing npm packages for tenon.io integration either a) lack the means to specify all options recognized by the API, or b) require an URL to test against. So I wrote a new module for our specific needs. It’s rather small, not much more than a request wrapper with a bit of parameter validation, and doesn’t introduce any additional dependencies. Tests for the module are also included in this PR.
I also made a few changes for more convenient development:
npm test
will now run all tests (we don’t have a huge test suite, so the previous split up into "test" and "test:all" commands was probably overkill) and use the nyc binary.npm start
will run the app with nodemon instead of node.Let’s see if the tenon.io setup works with our CircleCI project!
@JulianNorton Before you can run the test successfully with your API key, please make sure you have a project in your tenon.io account with the correct ID ("'weather-10kb" is defined in the test, but please feel free to change this if you already created a project ID for the app).