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

test.Diff output too verbose #80

Closed
rade opened this issue Dec 26, 2017 · 1 comment
Closed

test.Diff output too verbose #80

rade opened this issue Dec 26, 2017 · 1 comment
Labels

Comments

@rade
Copy link
Member

rade commented Dec 26, 2017

Here's an example of a test failure, reported with test.Diff

--- FAIL: TestContainerHostnameRenderer (0.08s)
	container_test.go:82: 
		--- want
		+++ have
		@@ -247,6 +247,45 @@
		 }
		 , }
		 }
		+, }) {
		+   psMap: (*ps.tree)(0xc420c760e0)(({;10.10.10.20;54001: {;10.10.10.20;54001 endpoint {} {} [;192.168.1.1;80] {0001-01-01 00:00:00 +0000 UTC []} {} {} map[] {} {}}, a1b2c3d4e5;<container>: {a1b2c3d4e5;<container> container {} {} [5e4d3c2b1a;<container>] {0001-01-01 00:00:00 +0000 UTC []} {} {} map[] {} {;10.10.10.20;54001: (report.Node) {
...
		+ Children: (report.NodeSet) {}
		+}
		+, }) {
		+           psMap: (*ps.tree)(0xc4208f7b90)(({;10.10.10.20;54002: {;10.10.10.20;54002 endpoint {} {} [;192.168.1.1;80] {0001-01-01 00:00:00 +0000 UTC []} {} {} map[] {} {}}, }
		+) {
		+            count: (int) 1,
		+            hash: (uint64) 14557804364885503053,
		+            key: (string) (len=18) ";10.10.10.20;54002",
		+            value: (report.Node) {
		+             ID: (string) (len=18) ";10.10.10.20;54002",
		+             Topology: (string) (len=8) "endpoint",
		+             Counters: (report.Counters) ({}) {
		+              psMap: (*ps.tree)(0x25e4c00)(({}
		+) {
		+               count: (int) 0,
		+               hash: (uint64) 0,
		+               key: (string) "",
		+               value: (interface {}) <nil>,
		+               children: ([8]*ps.tree) (len=8 cap=8) {
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>)
		+               }
		+              })
		+             },
		+             Sets: (report.Sets) ({}) {
		+              psMap: (*ps.tree)(0x25e4c00)(({}
		+) {
		+               count: (int) 0,
		+               hash: (uint64) 0,
		+               key: (string) "",
		+               value: (interface {}) <nil>,
		+               children: ([8]*ps.tree) (len=8 cap=8) {
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>),
		+                (*ps.tree)(0x25e4c00)(<already shown>)
		+               }
		+              })
		+             },
...

This is showing the internal structures of ps.Maps, which is clearly not desirable.

This used to work much better until 544c349. That set config.ContinueOnMethod = true, which causes structures to be traversed even when they implement Stringer.

@rade rade added the bug label Dec 26, 2017
@bboreham
Copy link
Collaborator

Showing the internal details is desirable in the case that String() has hidden something important. This is difficult to predict in a common library.

I think the real requirement is more like "only print out more if String() looks the same and DeepEqual is false"

yeya24 pushed a commit to yeya24/common that referenced this issue Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants