ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Can't use RunSpecsWithDefaultAndCustomReporters in parallel node

Open cdlliuy opened this issue 4 years ago • 3 comments

The documentation https://onsi.github.io/ginkgo/#writing-custom-reporters said:

RunSpecsWithDefaultAndCustomReporters will run your custom reporters alongside Ginkgo’s default reporter. RunSpecsWithCustomReporters will only run the custom reporters you pass in. If you wish to run your tests in parallel you should not use RunSpecsWithCustomReporters as the default reporter plays an important role in streaming test output to the ginkgo CLI.

=========== But in my test, I used RunSpecsWithDefaultAndCustomReporters and -nodes 2 together, then I can't get the output from custom reporter. Is the documentation above wrong?

=============

Here is my output with -nodes 1

 ginkgo  -nodes 1 .
Running Suite: Integration Suite
================================
Random Seed: 1590302584
Will run 2 of 2 specs

•
------------------------------
• Failure [0.000 seconds]
Parallelism
/e2e/test/ginkgo_test.go:74
  case2 [It]
 /e2e/test/ginkgo_test.go:88

  Expect to see this customized error msg for case 2
  Expected
      <int>: 8
  to be <
      <int>: 0

 /e2e/test/ginkgo_test.go:89
------------------------------
Customized Error Report Summary:
========================================
My Customized Output : Expect to see this customized error msg for case 2
Expected
    <int>: 8
to be <
    <int>: 0
========================================


Summarizing 1 Failure:

[Fail] Parallelism [It] case2
/e2e/test/ginkgo_test.go:89

Ran 2 of 2 Specs in 0.001 seconds
FAIL! -- 1 Passed | 1 Failed | 0 Pending | 0 Skipped
--- FAIL: TestIntegration (0.00s)
FAIL

Ginkgo ran 1 suite in 1m1.969570605s
Test Suite Failed

When using the -nodes 2

ginkgo  -nodes 2 .
Running Suite: Integration Suite
================================
Random Seed: 1590303808
Will run 2 specs

Running in parallel across 2 nodes

•
------------------------------
• Failure [0.001 seconds]
Parallelism
/e2e/test/ginkgo_test.go:74
  case2 [It]
 /e2e/test/ginkgo_test.go:88

  Expect to see this customized error msg for case 2
  Expected
      <int>: 8
  to be <
      <int>: 0

/e2e/test/ginkgo_test.go:89
------------------------------


Summarizing 1 Failure:

[Fail] Parallelism [It] case2
/e2e/test/ginkgo_test.go:89

Ran 2 of 2 Specs in 0.004 seconds
FAIL! -- 1 Passed | 1 Failed | 0 Pending | 0 Skipped


Ginkgo ran 1 suite in 13.47975086s
Test Suite Failed

As you can see , no Customized Error Report Summary: and its successors anymore

cdlliuy avatar May 24 '20 06:05 cdlliuy

@cdlliuy With more information, we might be able to address the issue. Can you share the code that initializes your custom reporter? Importantly, where does the reporter write its output?

dlipovetsky avatar Jan 13 '21 19:01 dlipovetsky

the interaction between custom reporters and parallelism is currently poorly supported. I'm exploring deprecating and removing custom reporters in V2 in lieu of a machine-readable JSON formatted output option that folks can build on top of instead. If you could share your original intention with the custom reporter and whether it might fit into such an option that would be super helpful!

onsi avatar Apr 04 '21 22:04 onsi

A beta for Ginkgo V2 just released. V2 revamps how custom reporting is supported and this use-case should now be unblocked.

Please try out the beta!

onsi avatar Sep 10 '21 20:09 onsi