-
Notifications
You must be signed in to change notification settings - Fork 91
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
[chore] update e2e tests to use BATS assertions #121
[chore] update e2e tests to use BATS assertions #121
Conversation
First learning from the experiment: |
Example output from BATS (not all real tests): |
The second note I added above "2) http span names do not match latest conventions" is fixed with #143 . I can update that after this gets merged or vice versa. |
The first note I added above "1) gorilla/mux spans are actually using the net/http probe" is partially fixed with #86 . There is still an extra net/http span there, but at least gorilla/mux scope will show up as expected. |
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 think this is great and we should take this PR as is, then update the tests in the other two PRs to use BATS.
c9a5c09
to
b039e4c
Compare
What do y'all think about removing the Update: upgrading this from a suggestion to a recommendation as I see my attempts to work on #106 do not produce a
The tests continue past this failed copy and, if the Known Good JSON remains present, the assertions about the trace data produced are checking the Known Good state. |
Does removing the traces.json still allow a jq comparision check? The BATS assertions are good for determining whether something expect is present but we can't check for unexpected data, eg additional span attributes. The jq comparison allows us to check the complete shape of the generated telemetry, with a few redacted values. Should we care about extra attributes if the ones we expect to be present are? |
Alrightie! Latest change:
I've held off adding an e2e suite for grpc because that instrumentation doesn't pass the assertions that the others do, yet. I reckon that work can be in a follow-up PR. |
Unrelated to the scope of the tests but might be nice given that the action is taking ~5 minutes :) concurrency:
group: ${{ github.ref }}
cancel-in-progress: true |
Would that addition be to # …
jobs:
kubernetes-test:
+ concurrency:
+ group: ${{ github.ref }}
+ cancel-in-progress: true
strategy:
matrix:
k8s-version: ["v1.26.0"]
library: ["gorillamux", "nethttp", "gin"]
# … And if I understand that correctly, it would cancel all of these e2e tests if any faster check against the same commit fails, right? Can the CI config change happen on a separate PR? Or does it block acceptance of this one? |
The addition would be at the workflow level as opposed to the job and added on line 10. The impact is pretty small and only applies in the case where a commit is pushed quickly after another. The new commit would trigger all the new e2e tests to re-run where most likely the runners from the previous commit should be cancelled to save runner minutes if they're still active. It's pretty small and might not come up frequently but I can add it as a separate PR if there is some interest For the behavior you were suggesting the |
It sounds like a good idea. I would support it† in a separate PR so that the conversation around adding short-circuits to CI can be distinct from the conversation here about an overhaul of end-to-end test assertions. † Disclosure: I am a new contributor to this project, so my support is of questionable value. |
@open-telemetry/go-instrumentation-approvers I believe this is ready and worthy of review. 🙇🏻 💌 💞 Update: 🤦🏻 Except it needs to be brought up-to-date with main. On it! Update to the update: it's up-to-date again. |
3263607
to
ab8f6ef
Compare
Updated the PR description text as well, so that it might work as the body of the message for a merge commit for this PR. |
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.
Looks great!
I think we have enough approvers, can we proceed to merge this?
9f38d73
to
a664dec
Compare
spans currently show net/http, will need review for lib name
PR open-telemetry#143 updated these span names to include HTTP method per the spec.
+ remove before verifying with e2e assertions + bring back redaction-jq as a function within the BATS utilities + assert no git difference with a BATS test
a664dec
to
0361d96
Compare
Updated this PR to include the proper tests for gorillamux now that #86 has been merged in. |
@open-telemetry/go-instrumentation-approvers This is ready for more eyes before we can merge. |
Short description of the changes
This can be run locally as well. You will get a
traces-orig.json
file for each test run, and from there you can further work with the tests by runningbats verify.bats
in the directory if you install bats locally.Note I added a TODO for gorilla/mux spans coming out with a scope name of net/http, probably as a result of being produced by the net/http probe. This is a PR for updating tests, so I propose fixing the probe source is out of scope and should be addressed in a separate PR.
How to verify that this has the expected result
e2e tests pass with expected results. Running locally with
make fixture-nethttp
and the others has expected results, and also creates a cleantraces.json
with expected output.To see an example of a fail locally, run one of the e2e tests (e.g.
make fixture-gin
), change directory totest/e2e/gin
, change the localtraces-org.json
(maybe change the real span ID to"nope"
), and runbats verify.bats
.