Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling colors breaks test suite #1469

Open
siretart opened this issue Nov 2, 2024 · 4 comments
Open

Disabling colors breaks test suite #1469

siretart opened this issue Nov 2, 2024 · 4 comments

Comments

@siretart
Copy link

siretart commented Nov 2, 2024

$ export GINKGO_NO_COLOR=true
$ make test
[...]
 FAIL: TestFormatter (0.00s)
 FAIL: TestCLIInternalSuite (0.02s)
 FAIL: TestTestingtproxy (0.01s)
 FAIL: TestReporters (0.09s)

I don't think my original implementation in #1464 had this issue though...

@onsi
Copy link
Owner

onsi commented Nov 2, 2024

hey - yeah the intent wasn't to support running the ginkgo test suite with the environment variable on. but i can dig into fixing it.

remind me again why you can't just use ginkgo -no-color?

@siretart
Copy link
Author

siretart commented Nov 2, 2024

In Debian, we purposefully disable go111 modules to avoid downloading sources from the Internet. Instead, all dependencies come from the Debian archive. To do this at scale, we have helpers that set the appropriate environment variables and carefully construct the build trees. For better or worse, these helpers have the testing part of the Debian package build hardcoded with go test, and this is not easy to replace.

@zhaohuxing
Copy link

zhaohuxing commented Nov 5, 2024

@onsi Hey, can create multi suit in same path?
I try write 2 suit in same file, run failed.

I want to diff case in diff suit, if right op?
bucket_test.go

package test_test

import (
        "fmt"
        "net/http"
        "testing"

        . "github.com/onsi/ginkgo/v2"
        . "github.com/onsi/gomega"
)

func TestBucket(t *testing.T) {
        RegisterFailHandler(Fail)
        RunSpecs(t, "Bucket Suite")
}

var _ = Describe("Bucket", func() {
        Context("HeadBucket", func() {
                It("normal request, http statu 200", func() {
                        url := "https://example.com"
                        resp, err := http.Head(url)
                        if err != nil {
                                fmt.Println("Error:", err)
                                return
                        }
                        defer resp.Body.Close()
                })
        })

        Context("GetBucket", func() {
                It("should authenticate an admin user with valid token", func() {
                })
        })
})

func TestObject(t *testing.T) {
        RegisterFailHandler(Fail)
        RunSpecs(t, "Object Suite")
}

var _ = Describe("Object", func() {
        Context("HeadBucket", func() {
                It("normal request, http statu 200", func() {
                        url := "https://example.com"
                        resp, err := http.Head(url)
                        if err != nil {
                                fmt.Println("Error:", err)
                                return
                        }
                        defer resp.Body.Close()
                })
        })

        Context("GetBucket", func() {
                It("should authenticate an admin user with valid token", func() {
                })
        })
})
Rerunning Suite
  It looks like you are calling RunSpecs more than once. Ginkgo does not support
  rerunning suites.  If you want to rerun a suite try ginkgo --repeat=N or
  ginkgo --until-it-fails

  Learn more at:
  http://onsi.github.io/ginkgo/#repeating-spec-runs-and-managing-flaky-specs


Ginkgo ran 1 suite in 2.666139542s

@onsi
Copy link
Owner

onsi commented Nov 5, 2024

hey @zhaohuxing this looks like it should be a new, different issue. can you open one if you'd like to discuss it further?

For now: you don't need separate TestX or to call RunSpecs more than once. You simply need to define all the Ginkgo specs (and you can split them across multiple files in the same package) and Ginkgo will collect them all and run them all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants