mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 02:45:42 +03:00
api: fixing join tests
This commit is contained in:
@@ -114,7 +114,7 @@ func (a *Agent) Join(addrs ...string) (int, error) {
|
||||
if resp.Error != "" {
|
||||
return 0, fmt.Errorf("failed joining: %s", resp.Error)
|
||||
}
|
||||
return resp.NumNodes, nil
|
||||
return resp.NumJoined, nil
|
||||
}
|
||||
|
||||
// Members is used to query all of the known server members
|
||||
@@ -138,8 +138,8 @@ func (a *Agent) ForceLeave(node string) error {
|
||||
// joinResponse is used to decode the response we get while
|
||||
// sending a member join request.
|
||||
type joinResponse struct {
|
||||
NumNodes int `json:"num_nodes"`
|
||||
Error string `json:"error"`
|
||||
NumJoined int `json:"num_joined"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
// AgentMember represents a cluster member known to the agent
|
||||
|
||||
@@ -11,10 +11,21 @@ import (
|
||||
|
||||
type configCallback func(c *Config)
|
||||
|
||||
// seen is used to track which tests we have already marked as parallel
|
||||
var seen map[*testing.T]struct{}
|
||||
|
||||
func init() {
|
||||
seen = make(map[*testing.T]struct{})
|
||||
}
|
||||
|
||||
func makeClient(t *testing.T, cb1 configCallback,
|
||||
cb2 testutil.ServerConfigCallback) (*Client, *testutil.TestServer) {
|
||||
// Always run these tests in parallel
|
||||
t.Parallel()
|
||||
// Always run these tests in parallel. Check if we have already
|
||||
// marked the current test, as more than 1 call causes panics.
|
||||
if _, ok := seen[t]; !ok {
|
||||
seen[t] = struct{}{}
|
||||
t.Parallel()
|
||||
}
|
||||
|
||||
// Make client config
|
||||
conf := DefaultConfig()
|
||||
|
||||
Reference in New Issue
Block a user