-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It appears that Slack is now sending recently-sent messages to a client when it connects. That is, it's possible to receive messages sent before you actually connect. This was causing lots of random failures in the tests, because we would end up making assertions on messages sent in response to previous tests! The actual functionality of the Slack provider was fine; this was purely a testing issue. Many changes were made to clean and tighten up the tests (detailed below), but the big take-home is that we now pay attention to message timestamps to determine whether to process a message or not. An overview of what was done: * Run Slack tests in Travis CI * Create a Slack client once per Slack suite, as opposed to once per Slack *test*. Though not strictly necessary, this reduces the chances of running afoul of Slack's throttling, which results in shorter overall test runs. * Update Slack tests to send test-specific messages. Previously, we'd send a lot of "echo blah" or "echo $TIMESTAMP" messages. Once Slack started apparently sending recently sent messages upon connection, this made for some hard-to-track-down false postives and timeouts. Now that every test sends unique (and traceable) messages, it's much easier to figure out what messages are being matched. * Clean up and refactor the testing Slack client In the course of debugging the tests, I discovered extra code in the testing Slack client (and its `SlackClientState`) that wasn't actually being used. For instance, we would store messages, but not actually do anything with them. We also never join a specific channel when connecting our test client (that is taken care of when setting up the Slack accounts, anyway), so that code is out. Finally, we don't currently test anything with edited messages, so that functionality is out, too. Additionally, we now explicitly pay attention to the timestamp of messages. When we send a message, we note its timestamp and only process responses with a greater timestamp. Fixes #1377
- Loading branch information
1 parent
59d265b
commit f3c3027
Showing
5 changed files
with
134 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ services: | |
|
||
env: | ||
- TEST=unit | ||
- TEST=slack | ||
- TEST=hipchat | ||
|
||
script: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.