bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
757 stars 298 forks source link

[go] No tests were found when running tests from a test suite #6427

Open gondyb opened 2 months ago

gondyb commented 2 months ago

Description of the bug:

When running tests from a test suite using the testify lib, the results aren't displayed in the test results UI, even though the stdout output confirms they're successful.

Which category does this issue belong to?

GoLand

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Create tests running in a test suite from testify and run them using the bazel intelliJ extension

Which Intellij IDE are you using? Please provide the specific version.

Goland 2024.1.1 Build #GO-241.15989.157

What programming languages and tools are you using? Please provide specific versions.

go 1.22 - testify library

What Bazel plugin version are you using?

2024.04.23.0.1-api-version-241

Have you found anything relevant by searching the web?

Didn't find anything for tests running in a suite

Any other information, logs, or outputs that you want to share?

image

Output log:

bzl test --tool_tag=ijwb:GoLand --curses=no --color=yes --progress_in_terminal_title=no --build_event_binary_file=/var/folders/dk/z685z0hx54ddsvbt_z94vtpr0000gp/T/intellij-bep-4b0c6d27-64d7-4f24-a80a-ded0d96ef60e --nobuild_event_binary_file_path_conversion --test_output=streamed --cache_test_results=no --test_env=GO_TEST_WRAP_TESTV=1 --test_filter=^<TestName>$ -- //<package>:go_default_integration_test
Testing started at 11:45 ...
INFO: Invocation ID: 132458d1-9b3c-486e-bd29-f545cf212933
WARNING: Streamed test output requested. All tests will be run locally, without sharding, one at a time
Loading: 
Loading: 0 packages loaded
INFO: Build option --test_env has changed, discarding analysis cache.
Analyzing: target //<package>:go_default_integration_test (0 packages loaded, 0 targets configured)
INFO: Analyzed target //<package>:go_default_integration_test (0 packages loaded, 39234 targets configured).
INFO: Found 1 test target...
[10 / 154] [Prepa] BazelWorkspaceStatusAction stable-status.txt
=== RUN   TestSuite
=== RUN   TestSuite/Test1
[2,134 / 2,135] Testing //<package>:go_default_integration_test; 1s local
=== RUN   TestSuite/Test2
=== RUN   TestSuite/Test3
--- PASS: TestSuite (10.71s)
    --- PASS: TestSuite/Test1 (1.31s)
    --- PASS: TestSuite/Test2 (1.11s)
    --- PASS: TestSuite/Test3 (2.10s)
    ...
PASS
[2,134 / 2,135] 1 / 1 tests; Testing //<package>:go_default_integration_test; 10s local
Target //<package>:go_default_integration_test up-to-date:
  bazel-bin/<package>/go_default_integration_test_/go_default_integration_test
INFO: Elapsed time: 12.740s, Critical Path: 11.53s
INFO: 2 processes: 1 internal, 1 local.
INFO: Build completed successfully, 2 total actions
//<package>:go_default_integration_test PASSED in 10.9s

Executed 1 out of 1 test: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
INFO: Build completed successfully, 2 total actions
INFO: Build Event Protocol files produced successfully.
INFO: Build completed successfully, 2 total actions
tpasternak commented 2 months ago

Hey, it's about GO_TEST_WRAP_TESTV=1 env variable missing. I was considering adding it by default (we already did it for some kinds of run configuration) but after consulting bazel slack I acknowledged it might kill remote caching

So the recommendation is to set this environment variable, either in .bazelrc or in the projecview file (in test_flags)

gondyb commented 2 months ago

Hey @tpasternak, as you can see in the Issue details, the GO_TEST_WRAP_TESTV=1 is already set when running the tests

tpasternak commented 2 months ago

oh, wait, indeed it's something new