go-errors / errors

errors with stacktraces for go
https://godoc.org/github.com/go-errors/errors
MIT License
921 stars 93 forks source link

Tests Are Failing #12

Closed drasko closed 6 years ago

drasko commented 7 years ago
drasko@Lenin:~/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors$ go test -v ./...
=== RUN   TestStackFormatMatches
--- FAIL: TestStackFormatMatches (0.00s)
    error_test.go:26: Stack didn't match
    error_test.go:27:   TestStackFormatMatches.func1: bs := [][]byte{Errorf("hi").Stack(), debug.Stack()}
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:479 (0x454e7c)
            call32: CALLFN(·call32, 32)
        /usr/lib/go-1.7/src/runtime/panic.go:458 (0x428883)
            gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:237 (0x4730a0)
            c: panic('a')
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:233 (0x473034)
            b: c()
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:228 (0x472ffa)
            a: b(5)
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:32 (0x471ac8)
            TestStackFormatMatches: a()
        /usr/lib/go-1.7/src/testing/testing.go:610 (0x46a3d1)
            tRunner: fn(t)
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:2086 (0x457971)
            goexit: BYTE    $0x90   // NOP
    error_test.go:28: runtime/debug.Stack(0xc4200160a0, 0xc42010a000, 0x442)
            /usr/lib/go-1.7/src/runtime/debug/stack.go:24 +0x79
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.TestStackFormatMatches.func1(0xc420020240)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:19 +0x170
        panic(0x4f0b40, 0xc42000e5e0)
            /usr/lib/go-1.7/src/runtime/panic.go:458 +0x243
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.c()
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:237 +0x60
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.b(0x5)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:233 +0x14
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.a(0x8, 0x52a660)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:228 +0x2a
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.TestStackFormatMatches(0xc420020240)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:32 +0x48
        testing.tRunner(0xc420020240, 0x52a668)
            /usr/lib/go-1.7/src/testing/testing.go:610 +0x81
        created by testing.(*T).Run
            /usr/lib/go-1.7/src/testing/testing.go:646 +0x2ec
=== RUN   TestSkipWorks
--- FAIL: TestSkipWorks (0.00s)
    error_test.go:49: Stack didn't match
    error_test.go:50: /usr/lib/go-1.7/src/runtime/panic.go:458 (0x428883)
            gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:237 (0x4730a0)
            c: panic('a')
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:233 (0x473034)
            b: c()
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:228 (0x472ffa)
            a: b(5)
        /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:55 (0x471b38)
            TestSkipWorks: a()
        /usr/lib/go-1.7/src/testing/testing.go:610 (0x46a3d1)
            tRunner: fn(t)
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:2086 (0x457971)
            goexit: BYTE    $0x90   // NOP
    error_test.go:51:   /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:43 +0x19e
        panic(0x4f0b40, 0xc42000e908)
            /usr/lib/go-1.7/src/runtime/panic.go:458 +0x243
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.c()
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:237 +0x60
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.b(0x5)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:233 +0x14
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.a(0x8, 0x52a650)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:228 +0x2a
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.TestSkipWorks(0xc4200203c0)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:55 +0x48
        testing.tRunner(0xc4200203c0, 0x52a658)
            /usr/lib/go-1.7/src/testing/testing.go:610 +0x81
        created by testing.(*T).Run
            /usr/lib/go-1.7/src/testing/testing.go:646 +0x2ec
=== RUN   TestNew
--- FAIL: TestNew (0.00s)
    error_test.go:79: Stack didn't match
    error_test.go:80:   TestNew: bs := [][]byte{New("foo").Stack(), debug.Stack()}
        /usr/lib/go-1.7/src/testing/testing.go:610 (0x46a3d1)
            tRunner: fn(t)
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:2086 (0x457971)
            goexit: BYTE    $0x90   // NOP
    error_test.go:81: runtime/debug.Stack(0xc4200162d0, 0xc420090b60, 0x145)
            /usr/lib/go-1.7/src/runtime/debug/stack.go:24 +0x79
        github.com/mainflux/mainflux/vendor/github.com/go-errors/errors.TestNew(0xc420020540)
            /home/drasko/go/src/github.com/mainflux/mainflux/vendor/github.com/go-errors/errors/error_test.go:72 +0x261
        testing.tRunner(0xc420020540, 0x52a640)
            /usr/lib/go-1.7/src/testing/testing.go:610 +0x81
        created by testing.(*T).Run
            /usr/lib/go-1.7/src/testing/testing.go:646 +0x2ec
=== RUN   TestIs
--- PASS: TestIs (0.00s)
=== RUN   TestWrapError
--- PASS: TestWrapError (0.00s)
=== RUN   TestWrapPrefixError
prefix: hi
--- PASS: TestWrapPrefixError (0.00s)
=== RUN   TestParsePanic
--- PASS: TestParsePanic (0.00s)
FAIL
exit status 1
FAIL    github.com/mainflux/mainflux/vendor/github.com/go-errors/errors 0.007s
rockstorm101 commented 6 years ago

Hi, I've stumbled across this very same issue too. Using Debian GNU/Linux 10 (Buster):

$ go version
go version go1.9.2 linux/amd64

Is this supposed to be this way? Am I missing something? This is a pretty old issue, @drasko did you find what causes this?

ConradIrwin commented 6 years ago

@rock, the tests were hardcoded to whatever the stack trace was on my machine at the point I wrote the library — it's probably just a formatting mismatch.

Pull requests welcome :)

Sent via Superhuman ( https://sprh.mn/?vip=conrad@superhuman.com )

On Thu, Nov 09, 2017 at 6:35 AM, Rock Storm < notifications@github.com > wrote:

Hi, I've stumbled across this very same issue too. Using Debian GNU/Linux 10 (Buster):

$ go version go version go1.9.2 linux/amd64

Is this supposed to be this way? Am I missing something? This is a pretty old issue, @ drasko ( https://github.com/drasko ) did you find what causes this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub ( https://github.com/go-errors/errors/issues/12#issuecomment-343172678 ) , or mute the thread ( https://github.com/notifications/unsubscribe-auth/AAFwQH5Ye3BBYk0X6cogurQibmsHTiPYks5s0w2ngaJpZM4KVOqP ).

rockstorm101 commented 6 years ago

Hi @ConradIrwin, I believe this issue is now fixed thanks to #17 :)

Would you consider releasing a new version (say 1.0.1) which includes this fix? I am working on packaging this library for Debian and I would love not having to patch the tests.

ConradIrwin commented 6 years ago

@rockstorm101 I've pushed the v1.0.1 tag.

rockstorm101 commented 6 years ago

Thanks a lot.