opentelemetry-go-instrumentation
opentelemetry-go-instrumentation copied to clipboard
Run bats tests in docker image
Originally posted by @MrAlias in https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/121#discussion_r1195459989
🫢 With all the dockering going on, I don't know why I didn't think of that.

OK. First challenge: the bats/bats image does not include jq upon which most of the test assertions are based. 😞
❯ make fixture-gin
…
kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/trace.json ./test/e2e/gin/traces-orig.json
rm -f ./test/e2e/gin/traces.json
docker run -it -v "/Users/robbkidd/work/tracing/otel/otel-go-inst:/code" bats/bats:latest ./test/e2e/gin/verify.bats
verify.bats
✗ go-auto :: includes service.name in resource attributes
(in test file test/e2e/gin/verify.bats, line 8)
`result=$(resource_attributes_received | jq "select(.key == \"service.name\").value.stringValue")' failed with status 127
/code/test/e2e/gin/verify.bats: line 8: jq: command not found
/code/test/e2e/gin/../../test_helpers/utilities.bash: line 19: jq: command not found
/code/test/e2e/gin/../../test_helpers/utilities.bash: line 30: jq: command not found
…
@MrAlias Is it needed for beta?
@MrAlias Is it needed for beta?
Not as far as I can see.