Returns a test configuration suitable for unit tests. If port parameters are set to zero an open port is chosen.
(replicas, rpcPort, discoveryPort int)
| 8 | // Returns a test configuration suitable for unit tests. If port parameters are set to zero |
| 9 | // an open port is chosen. |
| 10 | func buildTestConfig(replicas, rpcPort, discoveryPort int) *NodeConfig { |
| 11 | config := DefaultNodeConfig() |
| 12 | config.SerfConfig.MemberlistConfig.BindAddr = "127.0.0.1" |
| 13 | config.Replicas = replicas |
| 14 | config.RpcPort = rpcPort |
| 15 | config.SerfConfig.MemberlistConfig.BindPort = discoveryPort |
| 16 | return config |
| 17 | } |
| 18 | |
| 19 | // Returns a single test node with replica parameter of 2. |
| 20 | func defaultTestNode() (*Node, error) { |