Commit Graph

3776 Commits

Author SHA1 Message Date
Sean Chittenden c0aa155e61 Move lib's tests to lib_test
This suite of tests is only testing the exported functions
2016-03-29 19:51:37 -07:00
Sean Chittenden 0ad4fab7d4 Remove dead and incorrect code
This functionality is handled further upstream in `trimUDPAnswers()`
2016-03-29 19:38:26 -07:00
Sean Chittenden 64c1c12752 Whitespace, indent markdown correctly 2016-03-29 19:27:36 -07:00
Sean Chittenden d1166307aa Trim UDP responses per configuration 2016-03-29 19:27:21 -07:00
Sean Chittenden f8a0e1fb1a Merge branch 'b-dns-single-record' of ssh://github.com/hashicorp/consul into b-dns-single-record
# Conflicts:
#	command/agent/dns.go
2016-03-29 19:24:53 -07:00
Sean Chittenden a29f6e8c8f Allow adjusting the number of DNS records in a response...
Based on work done by @fusiondog in #1583, extend the concept to use an integer instead of a boolean.

Fixes: #1583 && #1481
2016-03-29 19:23:56 -07:00
Patrick Feliciano e533f9bce1 Adding singleton option to DNS for getaddrinfo bug. 2016-03-29 19:23:07 -07:00
Sean Chittenden ef7b13e81d Merge pull request #1894 from hashicorp/f-rename-server-manager
F rename server manager
2016-03-29 17:44:26 -07:00
Sean Chittenden 5ae7835988 Rename server_details package to agent 2016-03-29 17:39:19 -07:00
Sean Chittenden 7f06c71650 Add a quick package doc for the servers package 2016-03-29 16:22:53 -07:00
Sean Chittenden 897282f77d Rename serverConfig to serverList
serverList is a vastly more accurate name.  Chase accordingly.  No functional change other than types and APIs.
2016-03-29 16:17:16 -07:00
Sean Chittenden 4984b6111d Gratuitous rename 1/2
Reduce cognative load and perform an overdue rename.  No functional change.

Rename the `server_manager` package to `servers`.  Rename the `ServerManager` package to `Manager`.  In `client`, rename `serverMgr` to `servers`.
2016-03-29 16:12:00 -07:00
Sean Chittenden 47c3146342 Merge pull request #1880 from hashicorp/f-pretest-server
Pre-connect new rebalanced server
2016-03-29 11:12:59 -07:00
Sean Chittenden 4734e0113f Remove two unused constants 2016-03-29 11:11:41 -07:00
Sean Chittenden cb9833b134 Remove useless comment residual from decomposing functions 2016-03-29 10:53:00 -07:00
Sean Chittenden 1f049a3c38 EDYSLEXICMOMENT 2016-03-29 10:50:10 -07:00
Sean Chittenden 177f64134e Refactor out recocileServerList anon function
Add testing to reconcileServerList and test various server sizes.

Test that a percentage of nodes fail their Ping (50% in testing atm)
2016-03-29 02:45:38 -07:00
Sean Chittenden 6609ee5d51 Teach fauxConnPool to fail a pct of the time
50% failure rate seems legit as a starting point w/ 100 servers.
2016-03-28 14:53:29 -07:00
Sean Chittenden 7d26f7bfa7 Call NotifyFailedServers to rotate the server list 2016-03-28 14:12:41 -07:00
Sean Chittenden 6a987062b9 Add log line re: server manager backing off and sleeping
This is useful in situations where the RPC rotate duration is greater than 1µs.  WTB exponential backoff of logging so we don't spam forever.
2016-03-28 14:04:04 -07:00
Sean Chittenden 689b79aef3 Remove old debugging lines of questionable future value 2016-03-28 14:02:53 -07:00
Sean Chittenden 0b0a07a280 Shuffle in place
Don't create a copy and save the copy, not necessary any more.
2016-03-28 14:02:27 -07:00
Sean Chittenden e230b3a3b7 Nuke unnecessary comment
See above function comments for details
2016-03-28 13:57:36 -07:00
Sean Chittenden 34a29a2107 Move FIXME comment to the right call site 2016-03-28 13:49:55 -07:00
Sean Chittenden b38d3d71c8 Rename the ConnPoolPinger interface to Pinger 2016-03-28 13:46:01 -07:00
Sean Chittenden d6b4345375 Return error from PingConsulServer
In order to report why a Ping failed, change the signature of PingConsulServers to include an error message.
2016-03-28 13:38:58 -07:00
Sean Chittenden 6c9fb06511 Change the definition of the ServerDetails struct key
Use only the serf Name for now.  Leaving the plumbing for now.
2016-03-28 12:53:19 -07:00
Sean Chittenden 2bcff6bac4 Correct the comment to match reality 2016-03-28 12:32:30 -07:00
Sean Chittenden fc1edea1ef Rename serverCfg to sc for consistency 2016-03-28 12:06:26 -07:00
Sean Chittenden 988b05700d Add a quick length check
Verify that AddServer behaved as expected
2016-03-28 11:38:12 -07:00
Sean Chittenden 7181e42ba8 Switch the order of ServerDetails.String()
It's more natrual to have the network first.  I think I flipped the order accidentally.
2016-03-28 11:37:25 -07:00
Sean Chittenden dca8fd2643 Move rebalance log statement from INFO to DEBUG 2016-03-27 01:32:04 -07:00
Sean Chittenden 180edd8e7b Chase the API bump re: refreshServerRebalanceTimer
If it works in prod, why shouldn't it work in the tests?
2016-03-27 00:04:52 -07:00
Sean Chittenden 9b5dd7a785 Move initialization of the rebalanceTimer to New() 2016-03-27 00:03:48 -07:00
Sean Chittenden 86d1bad541 Add a test for ConnPool.PingConsulServer
Spin up 5x servers, join and ping each server
2016-03-26 23:52:06 -07:00
Sean Chittenden f903005080 Expose ServerManager.ResetRebalanceTimer
Move the rebalance timer from ServerManager.Start's stack to struct ServerManager.  This makes it possible to shuffle during tests without actually waiting >120s.
2016-03-26 23:41:01 -07:00
Sean Chittenden 2ba281bc5a Logging improvements
Comment out noisly loggers for the time being.

Improve the final logging statement to be useful and hint what the next active server for the client is going to be.
2016-03-26 22:41:08 -07:00
Sean Chittenden fab3981b1d Standardize the log message based on the package
This log statement used to belong in the consul package but has since moved to the server manager package.
2016-03-26 22:29:00 -07:00
Sean Chittenden c6d9c42d9f Reduce the error level from Fatal when unit testing 2016-03-26 22:07:09 -07:00
Sean Chittenden 4747cf3cab Start server rebalance task after init'ing Serf
Now that there is no longer an event loop driven directly by Serf, start the ServerManager task after Serf has been setup.  When testing and adjusting timers and timeouts to unreasonably low values, it's possible to tickle a race condition where Serf's NumNodes() would fail because Serf had not been initialized.
2016-03-26 22:04:41 -07:00
Sean Chittenden 2ddf82d9d8 Catch up to a few renames 2016-03-26 19:32:11 -07:00
Sean Chittenden 640ced7c11 Use empty string for addr in ServerDetails.String() 2016-03-26 19:30:04 -07:00
Sean Chittenden e0f29c17cd Guard against a nil ServerDetails.Addr
It's not clear how or why this would ever be nil, but some of the unit tests produce a nil addr.  Be defensive.
2016-03-26 19:29:31 -07:00
Sean Chittenden 2d9982eb27 Proactively ping server before rotation
Before shuffling the server list, proactively ping the next server in the list to establish the connection and verify the remote endpoint is healthy.
2016-03-26 19:28:13 -07:00
Sean Chittenden b3a8e2f115 Factor out the shuffle server 2016-03-26 19:19:04 -07:00
Sean Chittenden 766ddae165 Revise comments re: cycleServer
Improve the comments to discuss what happens presently.  Add a note to consider possibly calling to TestConsulServer proactively.
2016-03-26 18:53:13 -07:00
Sean Chittenden ac1d42e9d8 Comment why the interface is needed: cyclic import 2016-03-26 18:38:35 -07:00
Sean Chittenden a9b3dba05f Add a struct key type for server_details 2016-03-26 17:58:12 -07:00
Sean Chittenden 22aa08d407 Merge pull request #1873 from hashicorp/f-rebalance-worker-0.7
Periodically rebalance the servers that agents talk to
2016-03-25 15:03:18 -07:00
Sean Chittenden 496f05b561 Add additional checks 2016-03-25 14:40:46 -07:00