mozilla-services/pushgo — pull request #71 by kitcambridge (2014-08-25 23:32:12+00:00)
Title: Implement pluggable discovery adapters and standalone tests

This pull request adds a `Locator` interface for server discovery, extracts the etcd discovery implementation into an `EtcdLocator`, and adds a `StaticLocator` adapter. The config loading mechanism has also been refactored, making it possible to run the tests without etcd, memcached, or a standalone Simple Push server.

* The router now uses a buffered channel (`bucket_size`) instead of partitioning contacts into buckets.
* The etcd key prefix and minimum refresh interval are exposed as `EtcdLocatorConf.Dir` and `.RefreshInterval`, respectively.
* `EtcdLocator` now uses the normalized key (prefix + hostname) consistently, and accounts for non-default HTTPS ports when constructing the key.
* The `PluginLoaders` map associates plugin types (i.e., logger, proprietary pinger, metrics, storage adapter, router, locator, server, and handlers) with initialization functions. This is used by `TestServer` to specify configuration options programmatically. The `*Conf` structures have also been flattened where appropriate.
* The `Host` and `Port` options have been consolidated into `Addr`. If `Addr` is omitted, the server and router will listen on random ports.
* `Server` and `Router` now initialize their own `net.Listener`s, avoiding a race condition where the tests would begin running before the server was ready.

Closes #30. @bbangert, @jrconlin, @rafrombrc r?