smarty / assertions

Fluent assertion-style functions used by goconvey and gunit. Can also be used in any test or application.
Other
100 stars 34 forks source link

Golang 1.16 beta 1: TestMapSortRendering fails on s390x #42

Closed eclipseo closed 3 years ago

eclipseo commented 3 years ago

On Fedora rawhide, Golang 1.16 beta 1, s390x architecture, the following test fail:

--- FAIL: TestMapSortRendering (0.00s)
    render_test.go:29: On line #279, [] did not match expectations:
        Expected: map[interface{}]struct {}{1:{}, 2:{}, 3:{}, "foo":{}}
        Actual  : map[interface{}]struct {}{3:{}, 1:{}, 2:{}, "foo":{}}
FAIL
exit status 1
FAIL    github.com/smartystreets/assertions/internal/go-render/render   0.004s
mdwhatcott commented 3 years ago

@eclipseo - There are known issues surrounding assertions against map[string]interface{}:

Might this be a duplicate issue?

eclipseo commented 3 years ago

It doesn't look like it, it is specific to 1.16, 1.15 works.

mdwhatcott commented 3 years ago

@eclipseo - I've tried to replicate the failure with the following test case:

func TestIssue42(t *testing.T) {
    a := map[interface{}]struct {}{1:{}, 2:{}, 3:{}, "foo":{}}
    b := map[interface{}]struct {}{3:{}, 1:{}, 2:{}, "foo":{}}
    New(t).So(a, ShouldResemble, b)
}

Here's the output I'm getting on 64-bit Ubuntu 20.04.1 LTS:

mike@mikewhat:~/code/src/github.com/smartystreets/assertions$ ~/Desktop/go1.16/go/bin/go version
go version go1.16beta1 linux/amd64
mike@mikewhat:~/code/src/github.com/smartystreets/assertions$ ~/Desktop/go1.16/go/bin/go test -v -run TestIssue42
=== RUN   TestIssue42
--- PASS: TestIssue42 (0.00s)
PASS
ok      github.com/smartystreets/assertions 0.001s

So, I'm not able to replicate. Did I get the test right? (does the above test case fail on your system?) Or is this failure specific to your architecture?

eclipseo commented 3 years ago

@eclipseo - I've tried to replicate the failure with the following test case:

func TestIssue42(t *testing.T) {
  a := map[interface{}]struct {}{1:{}, 2:{}, 3:{}, "foo":{}}
  b := map[interface{}]struct {}{3:{}, 1:{}, 2:{}, "foo":{}}
  New(t).So(a, ShouldResemble, b)
}

Here's the output I'm getting on 64-bit Ubuntu 20.04.1 LTS:

mike@mikewhat:~/code/src/github.com/smartystreets/assertions$ ~/Desktop/go1.16/go/bin/go version
go version go1.16beta1 linux/amd64
mike@mikewhat:~/code/src/github.com/smartystreets/assertions$ ~/Desktop/go1.16/go/bin/go test -v -run TestIssue42
=== RUN   TestIssue42
--- PASS: TestIssue42 (0.00s)
PASS
ok    github.com/smartystreets/assertions 0.001s

So, I'm not able to replicate. Did I get the test right? (does the above test case fail on your system?) Or is this failure specific to your architecture?

I have no issue with other arches, only on s390x, which is tricky to test as it's on a CI system I don't have access to. It's probably a change made to Go dusing the 1.16 window but I haven't been able to find any clue in the commit log. Maybe I should report to upstream Go with your testcase is I manage to reproduce it.

(Full log https://koji.fedoraproject.org/koji/taskinfo?taskID=60502076)

mdwhatcott commented 3 years ago

@eclipseo - Yeah, it very well could be an issue with Go that should be reported. But you'll probably need to come up with code to reproduce the problem but ideally that code would be independent of this library. Can you isolate the change to a single method call in the ShouldResemble behavior? For instance, is it the call to reflect.DeepEqual() (or maybe somewhere close to that)?

openarun commented 2 years ago

Looks related to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008443 . distro : debian/sid go version : 1.18

openarun commented 2 years ago

47