onsi / ginkgo

A Modern Testing Framework for Go
http://onsi.github.io/ginkgo/
MIT License
8.22k stars 650 forks source link

Ginkgo will not print any Describe output after v1 -> v2 upgrade #1267

Closed jooseppi-luna closed 1 year ago

jooseppi-luna commented 1 year ago

I just upgraded our e2e testing setup from ginkgo v1.16.5 to v2.11.0, but now there is no output coming from my describe block. Here is an example of what a test run would looked like with ginkgo v1.16.5 (just showing one scenario):

[root@rhel-ctrl-plane e2e]# ./run-e2e-test.sh
/root/csm-operator/tests/e2e
Aug 21 19:57:34.788: INFO: The --provider flag is not set. Continuing as if --provider=skeleton had been used.
Running Suite: CSM Operator End-to-End Tests
============================================
Random Seed: 1692662248 - Will randomize all specs
Will run 1 of 1 specs

STEP: Getting test environment variables
STEP: []
STEP: Reading values file
STEP: Getting a k8s client
W0821 19:57:34.788375 1556274 test_context.go:460] Unable to find in-cluster config, using default host : https://127.0.0.1:6443
[run-e2e-test]E2E Testing
  Running all test Given Test Scenarios
  /root/csm-operator/tests/e2e/e2e_test.go:123
[It] Running all test Given Test Scenarios
  /root/csm-operator/tests/e2e/e2e_test.go:123
STEP: Starting: Install App Mobility with Cert-Manager and Velero
STEP:      Executing  Given an environment with k8s or openshift, and CSM operator installed
STEP:      Executing  Apply custom resource [1]
Aug 21 19:57:34.825: INFO: Running '/usr/bin/kubectl --namespace=application-mobility apply --validate=true -f -'
Aug 21 19:57:35.295: INFO: stderr: ""
Aug 21 19:57:35.295: INFO: stdout: "containerstoragemodule.storage.dell.com/application-mobility created\n"
STEP:      Executing  Validate [application-mobility] module from CR [1] is installed
STEP:      Executing  Enable forceRemoveModule on CR [1]
STEP:      Executing  Delete custom resource [1]
STEP: Ending: Install App Mobility with Cert-Manager and Velero

• [SLOW TEST:45.559 seconds]
[run-e2e-test]E2E Testing
/root/csm-operator/tests/e2e/e2e_test.go:122
  Running all test Given Test Scenarios
  /root/csm-operator/tests/e2e/e2e_test.go:123
------------------------------

Ran 1 of 1 Specs in 45.590 seconds
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS

Ginkgo ran 1 suite in 52.157073493s
Test Suite Passed

However, now we have lost most of this output and a test run looks like this:

[root@rhel-ctrl-plane e2e]# ./run-e2e-test.sh
/root/csm-operator/tests/e2e
=== RUN   TestE2E
  W0823 09:48:29.152033 3771507 test_context.go:508] Unable to find in-cluster config, using default host : https://127.0.0.1:6443
  Aug 23 09:48:29.152: INFO: The --provider flag is not set. Continuing as if --provider=skeleton had been used.
Running Suite: CSM Operator End-to-End Tests - /root/csm-operator/tests/e2e
===========================================================================
Random Seed: 1692798509

Will run 1 of 1 specs

•

Ran 1 of 1 Specs in 45.843 seconds
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestE2E (45.84s)
PASS

Ginkgo ran 1 suite in 1m18.723502201s
Test Suite Passed

As you can see, there is no output during the test run. We are running the tests using ginkgo -mod=mod -v. This is our describe block:

var _ = Describe("[run-e2e-test] E2E Testing", func() {
        It("Running all test Given Test Scenarios", func() {
                for _, test := range testResources {
                        By(fmt.Sprintf("Starting: %s ", test.Scenario.Scenario))
                        if ContainsModules(test.Scenario.Modules, installedModules) == false {
                                By(fmt.Sprintf("Required module %s not installed, skipping", test.Scenario.Modules))
                                By(fmt.Sprintf("Ending: %s\n", test.Scenario.Scenario))
                                continue
                        }

                        for _, stepName := range test.Scenario.Steps {
                                By(fmt.Sprintf("%s Executing  %s", beautify, stepName))
                                Eventually(func() error {
                                        return stepRunner.RunStep(stepName, test)
                                }, timeout, interval).Should(BeNil())
                        }
                        By(fmt.Sprintf("Ending: %s\n", test.Scenario.Scenario))
                        time.Sleep(5 * time.Second)
                }
        })
})

Here is a link to our testing setup, if that helps. The e2e.go and e2e_test.go files have most of the ginkgo-related code in them.

onsi commented 1 year ago

This should be working without issue. can you confirm that the version of the cli you are using is the same as the version of the library in go.mod? what does ginkgo version say?

jooseppi-luna commented 1 year ago

Oh shoot that's what it was! I thought the version of Ginkgo was upgraded with go get but it was still running v1.16.5. Thanks so much for the help and sorry for the bother

onsi commented 1 year ago

hey no worries - glad we could figure it out. more recent versions of ginkgo now warn you when this mismatch occurs so you should have a faster feedback loop going forward.