Skip to content

bazel coverage failure 0.9.0 -> 0.10.0 #74

@rajukrishnamurthy

Description

@rajukrishnamurthy

Hi I'm attempting to upgrade rules_opa from 0.9.0 to 0.10.0. It looks like coverage support was added in 0.10.0, however, I can't seem to make it work. The tests without coverage are passing, but with coverage, I'm getting:

% bazel coverage --combined_report=lcov  //my_project:opa_lib_test
INFO: Build option --instrumentation_filter has changed, discarding analysis cache.
INFO: Analyzed target //my_project:opa_lib_test (0 packages loaded, 3783 targets configured).
INFO: Found 1 test target...
FAIL: //my_project:opa_lib_test (see /tmp/bazel_cache/execroot/videoamp/bazel-out/darwin_arm64-fastbuild/testlogs/my_project/opa_lib_test/test.log)
INFO: From Testing //my_project:opa_lib_test:
==================== Test output for //my_project:opa_lib_test:
Traceback (most recent call last):
  File "/tmp/bazel_cache/sandbox/darwin-sandbox/11969/execroot/videoamp/bazel-out/darwin_arm64-fastbuild/bin/my_project/opa_lib_test_test.sh.runfiles/rules_opa/tools/opa_coverage.py", line 109, in <module>
    main(sys.argv)
  File "/tmp/bazel_cache/sandbox/darwin-sandbox/11969/execroot/videoamp/bazel-out/darwin_arm64-fastbuild/bin/my_project/opa_lib_test_test.sh.runfiles/rules_opa/tools/opa_coverage.py", line 87, in main
    result = CoverageReport.from_dict(json.loads(proc.stdout))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/bazel_cache/sandbox/darwin-sandbox/11969/execroot/videoamp/bazel-out/darwin_arm64-fastbuild/bin/my_project/opa_lib_test_test.sh.runfiles/rules_opa/tools/opa_coverage.py", line 63, in from_dict
    files={
          ^
  File "/tmp/bazel_cache/sandbox/darwin-sandbox/11969/execroot/videoamp/bazel-out/darwin_arm64-fastbuild/bin/my_project/opa_lib_test_test.sh.runfiles/rules_opa/tools/opa_coverage.py", line 64, in <dictcomp>
    file: CoverageFile.from_dict(report)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/bazel_cache/sandbox/darwin-sandbox/11969/execroot/videoamp/bazel-out/darwin_arm64-fastbuild/bin/my_project/opa_lib_test_test.sh.runfiles/rules_opa/tools/opa_coverage.py", line 49, in from_dict
    coverage=float(data.get("coverage")),
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'

I've tried this on several architectures, and we're still on bazel 6.2.1 which might be the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions