Skip to content

test.Diff output too verbose #80

@rade

Description

@rade

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions