Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flapping tests #4

Merged
merged 5 commits into from
May 18, 2016
Merged

Fix flapping tests #4

merged 5 commits into from
May 18, 2016

Conversation

talbright
Copy link
Owner

@talbright talbright commented May 17, 2016

For server cluster setup fix, some ideas were drawn from samuel#76 (However, that solution was not complete and required additional refactoring.)

@talbright
Copy link
Owner Author

talbright commented May 17, 2016

Known flapping tests:

+
+--- FAIL: TestNoQuorum (1.47s)
+       cluster_test.go:143: Disconnect from wrong server: expected=127.0.0.1:12431, actual=127.0.0.1:12428
+

+--- FAIL: TestDNSHostProviderReconnect (2.13s)
+       dnshostprovider_test.go:130: Connected to "localhost:12728". Finding test server index…
+       dnshostprovider_test.go:134: …trying "localhost:12728"
+       dnshostprovider_test.go:137: …found at index 0
+       dnshostprovider_test.go:151: Create returned error: zk: connection closed
+

+
+--- FAIL: TestFLWSrvr (0.00s)
+       flw_test.go:86: listen tcp 127.0.0.1:2181: bind: address already in use
+

@talbright talbright force-pushed the fix-flapping-tests branch 2 times, most recently from 335ac6e to 30499fb Compare May 17, 2016 21:14
@talbright talbright changed the title More careful checks that test cluster is up/down before/after tests Fix flapping tests due to improper handling of cluster server in tests May 17, 2016
- use FLWRuok in a retry loop to determine if server was started or stopped
- panic if server cannot be started or stopped; there's no reason to continue
testing as at this point results are non-deterministic
- modify test ServerStruct to hold state and its address

As a side affect tests will now run slower but should be more consistent.
@talbright talbright force-pushed the fix-flapping-tests branch from 30499fb to 1d4257f Compare May 17, 2016 21:37
@talbright talbright changed the title Fix flapping tests due to improper handling of cluster server in tests Fix flapping tests May 17, 2016
@talbright talbright force-pushed the fix-flapping-tests branch 2 times, most recently from 0b6e907 to 8848dad Compare May 17, 2016 23:15
talbright added 2 commits May 17, 2016 19:25
- fail test if listener can't be closed
- pause during defer to give listener a chance to close
It looks like the logic in this test is incorrect. To be sure I've added
some logging, but commented out the potentially flawed test logic. Will
need to keep an eye on it.
@talbright talbright force-pushed the fix-flapping-tests branch from 8848dad to 6f42e87 Compare May 17, 2016 23:35
@talbright talbright force-pushed the fix-flapping-tests branch from cfdba11 to f03475c Compare May 18, 2016 00:10
- more logging
- fix error handling
@talbright talbright force-pushed the fix-flapping-tests branch from 73ec936 to ea8a1e8 Compare May 18, 2016 03:03
@talbright
Copy link
Owner Author

Ran the following locally, no errors:

touch test.log
for i in {1..20}
do
    echo "running test $i"
    go test -v -race -coverprofile=profile.cov ./zk >& test${i}.log
  if [ "$?" -ne 0 ]; then
        echo "test $i failed"
    fi
    echo "test $i finished"
done

@talbright talbright merged commit 328cb65 into master May 18, 2016
@talbright talbright deleted the fix-flapping-tests branch May 18, 2016 04:28
@talbright talbright mentioned this pull request May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant