-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix: [sc-105230] particle-api-js getEventStream does not honor setContext / X-Particle-Tool http header correctly #147
base: master
Are you sure you want to change the base?
Conversation
…e-Project http headers get set as we'd expect when using setContext('tool') or setContext('project')
Specifically, this change makes this linter error go away: /Users/me/git/particle-api-js/test/Particle.spec.js:941:78: Parsing error: Unexpected token => [Error]`
This makes it so that PARTICLE_API_TOKEN and PARTICLE_API_BASE_URL don't have to be specified for `npm run test:unit` and other npm run commands
586d595
to
fbf6100
Compare
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.
The `Agent` integration tests ([source](./test/Agent.integration.js)) depend on a real HTTP api backend and a valid Particle access token. Be sure to set relevant environment variables to avoid test failures. You can prefix commands test commands like this `PARTICLE_API_BASE_URL=<url> PARTICLE_API_TOKEN=<token> npm test` | ||
|
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.
Also, eliminates problem where PARTICLE_API_TOKEN had to be specified for many npm run commands by moving *.js files that require these to an e2e-tests that does NOT run in CI. This is not a step down in terms of quality; as these tests were not designed to be run in this CI context, but rather manually by developers working on the event stream.
fwiw, @deleonn updated CI over in #142 to ensure at least the node-side event e2e tests ran with their required perquisites - here's an example of them running and "passing":
further complicating things, the reference to "Agent
integration tests" in these docs is incorrect - it's actually the test/EventStream-e2e-node.js
file which is running in CI.
all that said, at this point i'd just delete all of those (e2e-tests
directory and related) as they're likely to cause more confusion than help.
Cool. I'll remove circle ci vars, nuke |
Description
Fixes bug sc-105230 by passing
X-Particle-Tool
orX-Particle-Project
http headers accordingly to event stream http requests that honorparticleAPI.setContext('tool|project')
. This work makes it so that Delorean CLI telemetry will be accurate when event stream consuming commands are introduced.Also, eliminates problem where PARTICLE_API_TOKEN had to be specified for many
npm run
commands by moving*.js
files that require these to an e2e-tests that does NOT run in CI. This is not a step down in terms of quality; as these tests were not designed to be run in this CI context, but rather manually by developers working on the event stream.How to test?
Get the branch setup: git checkout, cd into repo, nvm use,
npm i
👍npm run compile
npm run test:ci
; observe no failures due to PARTICLE_API_TOKEN not being setfoo.js
snippet in the parent dir where your git checkout isnode foo.js
_headers
has[email protected]
in it (thus proving http headers are now honored)