slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.64k stars 1.13k forks source link

Test failure in TestRTMDisconnect #1116

Closed CyrilBrulebois closed 1 year ago

CyrilBrulebois commented 1 year ago

What happened

While building a Debian package in a clean and minimal environment, the following test fails:

=== RUN   TestRTMDisconnect
    websocket_managed_conn_test.go:197: discarded event of type 'connection_error' with content '&slack.ConnectionErrorEvent{Attempt:1, Backoff:100000000, ErrorObj:(*url.Error)(0xc006cef920)}'
    websocket_managed_conn_test.go:197: discarded event of type 'connection_error' with content '&slack.ConnectionErrorEvent{Attempt:2, Backoff:200000000, ErrorObj:(*url.Error)(0xc006fca000)}'
    websocket_managed_conn_test.go:197: discarded event of type 'connection_error' with content '&slack.ConnectionErrorEvent{Attempt:3, Backoff:400000000, ErrorObj:(*url.Error)(0xc006bedd10)}'
    websocket_managed_conn_test.go:197: discarded event of type 'connection_error' with content '&slack.ConnectionErrorEvent{Attempt:4, Backoff:800000000, ErrorObj:(*url.Error)(0xc006ebf650)}'
    websocket_managed_conn_test.go:197: discarded event of type 'connection_error' with content '&slack.ConnectionErrorEvent{Attempt:5, Backoff:1600000000, ErrorObj:(*url.Error)(0xc006f34570)}'
    websocket_managed_conn_test.go:197: discarded event of type 'connection_error' with content '&slack.ConnectionErrorEvent{Attempt:6, Backoff:3200000000, ErrorObj:(*url.Error)(0xc006f34f00)}'
    websocket_managed_conn_test.go:205: timed out waiting for disconnect
    websocket_managed_conn_test.go:211:
               Error Trace:    /build/golang-github-slack-go-slack-0.11.3/_build/src/github.com/slack-go/slack/websocket_managed_conn_test.go:211
               Error:          Should be true
               Test:           TestRTMDisconnect
               Messages:       Should have received a disconnected event from the RTM instance.
--- FAIL: TestRTMDisconnect (5.00s)

I haven't been able to pinpoint what's happening just yet, but I'd be happy to learn a little more about what the test is supposed to be checking, so that I can figure out whether some components are missing in my chroot, whether some network access is required, etc.

Expected behavior

While building the exact same Debian package in a development environment, the test passes just fine:

=== RUN   TestRTMDisconnect
    websocket_managed_conn_test.go:188: invalid auth event received
--- PASS: TestRTMDisconnect (0.26s)

Steps to reproduce

I'll update this ticket once I have published my work in progress to https://salsa.debian.org/

Versions

CyrilBrulebois commented 1 year ago

Steps to reproduce, in a Debian environment (this doesn't need to be unstable or testing, stable is fine):

  1. Generate a source package:
git clone https://salsa.debian.org/go-team/packages/golang-github-slack-go-slack.git
cd golang-github-slack-go-slack
uscan --download-current --rename
dpkg-buildpackage -S -d
cd ..
  1. Create a build environment, it's Debian unstable by default:
sudo cowbuilder --create
  1. Build the package in that environment:
sudo cowbuilder --build golang-github-slack-go-slack_0.11.3-2.dsc
kanata2 commented 1 year ago

Thanks for reporting. This is known issue. https://github.com/slack-go/slack/issues/861

CyrilBrulebois commented 1 year ago

Oh, my bad, that other issue didn't show up when searching for the test's name. That being said, it fails reliably for me, not just occasionally.