🐞 Testing: show more output

When tests with long output fail, I have difficulty troubleshooting
because Gomega truncates the output at 4000 bytes. With this commit, we
tell Gomega not to truncate the output, which allows me to see what's
broken, which is invariably at the end of the output.

Fixes, when running `gingko -r .`:

```
Gomega truncated this representation as it exceeds 'format.MaxLength'.
Consider having the object provide a custom 'GomegaStringer' representation
or adjust the parameters in Gomega's 'format' package.
```
This commit is contained in:
Brian Cunnie
2025-05-20 10:49:25 -07:00
parent f634ea9dec
commit 75fc68005d

View File

@@ -14,6 +14,7 @@ import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
. "github.com/onsi/gomega/gbytes" . "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec" . "github.com/onsi/gomega/gexec"
) )
@@ -25,6 +26,7 @@ var port = getFreePort()
var serverPath, _ = Build("main.go") var serverPath, _ = Build("main.go")
var _ = BeforeSuite(func() { var _ = BeforeSuite(func() {
format.MaxLength = 0 // need more output, 4000 is the default
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
serverCmd = exec.Command(serverPath, "-port", strconv.Itoa(port), "-blocklistURL", "file://etc/blocklist-test.txt") serverCmd = exec.Command(serverPath, "-port", strconv.Itoa(port), "-blocklistURL", "file://etc/blocklist-test.txt")
serverSession, err = Start(serverCmd, GinkgoWriter, GinkgoWriter) serverSession, err = Start(serverCmd, GinkgoWriter, GinkgoWriter)