ssh-chat icon indicating copy to clipboard operation
ssh-chat copied to clipboard

Fix flaky tests

Open shazow opened this issue 9 years ago • 4 comments

  • [x] --- FAIL: TestHostNameCollision (0.01s) host_test.go:74: First client failed to get 'foo' name: " \* foo joined. (Connected: 1)" https://github.com/shazow/ssh-chat/commit/c57a5acca7096c056414dfb837e65a2bb750daef
  • [ ] --- FAIL: TestIgnore (0.00s) room_test.go:148: should have messages
  • [x] --- FAIL: TestSetExpiring (0.00s) set_test.go:78: b-prefix incorrect: ["barbar" "2017-05-11 11:54:27.161591982 -0400 EDT"]
  • [ ] --- FAIL: TestHostGetPrompt (0.00s) host_test.go:44: Got: "[\x1b[38;05;172mfoo\x1b[0m] "; Expected: "[\x1b[38;05;88mfoo\x1b[0m] "

shazow avatar Aug 06 '16 16:08 shazow

Hello!

Is there an update on this?

I am working on a RPM package for ssh-chat, and encounter FAIL: TestHostGetPrompt on the architectures armv7l and i586 (which are not super important, as most people are likely using it on x86_64, but it would still be nice to widen the target audience - and I don't feel like disabling tests for those two architectures, if they work with x86_64 just fine). If you are interested in checking it out, you can find the build logs in https://build.opensuse.org/package/show/home:crameleon/ssh-chat (so far only SLES and openSUSE are relevant, still working on adapting the spec to Fedora and CentOS, so those are expected to fail).

Cheers!

tacerus avatar Mar 09 '21 13:03 tacerus

@tacerus Hiya, thanks for following up! I appreciate you maintaining this distro package downstream. :)

We did make progress on x86 as you noticed, go test -test.timeout 5s -count 100 ./... works reliably.

I'm not certain why arm7l and i586 would still have issues. One suggestion: Could try running it with/without -race, I recall that have a side effect on whether some tests were flakey before or not.

For what it's worth, it's not a super important test, the flake is simply messages coming in out of order. If you'd like to disable it for those builds, I think it's reasonable.

shazow avatar Mar 09 '21 15:03 shazow

Thanks for the input and headsup!

[ 47s] go test: -race is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64, darwin/arm64, and windows/amd64

I found that the tests pass if I run them only against /cmd/ssh-chat and will hence go ahead and implement a clause that will do that only for the problematic architectures.

tacerus avatar Mar 09 '21 21:03 tacerus

I got excited too early, after some testing this workaround showed only reliable on i586, on armv7l it would still fail. I hence implemented the cmd/ssh-chat workaround for i586 and skipped tests completely on armv7l, adding a note referring this issue.

tacerus avatar Mar 09 '21 22:03 tacerus