|
|
@ -35,7 +35,7 @@ func Test_SingleJoinOK(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
defer ts.Close()
|
|
|
|
defer ts.Close()
|
|
|
|
|
|
|
|
|
|
|
|
j, err := Join([]string{ts.URL}, "id0", "127.0.0.1:9090", false, nil,
|
|
|
|
j, err := Join("127.0.0.1", []string{ts.URL}, "id0", "127.0.0.1:9090", false, nil,
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
@ -60,7 +60,7 @@ func Test_SingleJoinZeroAttempts(t *testing.T) {
|
|
|
|
t.Fatalf("handler should not have been called")
|
|
|
|
t.Fatalf("handler should not have been called")
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|
_, err := Join([]string{ts.URL}, "id0", "127.0.0.1:9090", false, nil, 0, attemptInterval, nil)
|
|
|
|
_, err := Join("127.0.0.1", []string{ts.URL}, "id0", "127.0.0.1:9090", false, nil, 0, attemptInterval, nil)
|
|
|
|
if err != ErrJoinFailed {
|
|
|
|
if err != ErrJoinFailed {
|
|
|
|
t.Fatalf("Incorrect error returned when zero attempts specified")
|
|
|
|
t.Fatalf("Incorrect error returned when zero attempts specified")
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -90,7 +90,7 @@ func Test_SingleJoinMetaOK(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
nodeAddr := "127.0.0.1:9090"
|
|
|
|
nodeAddr := "127.0.0.1:9090"
|
|
|
|
md := map[string]string{"foo": "bar"}
|
|
|
|
md := map[string]string{"foo": "bar"}
|
|
|
|
j, err := Join([]string{ts.URL}, "id0", nodeAddr, true, md,
|
|
|
|
j, err := Join("", []string{ts.URL}, "id0", nodeAddr, true, md,
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
@ -117,7 +117,7 @@ func Test_SingleJoinFail(t *testing.T) {
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
defer ts.Close()
|
|
|
|
defer ts.Close()
|
|
|
|
|
|
|
|
|
|
|
|
_, err := Join([]string{ts.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
_, err := Join("", []string{ts.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|
t.Fatalf("expected error when joining bad node")
|
|
|
|
t.Fatalf("expected error when joining bad node")
|
|
|
@ -132,7 +132,7 @@ func Test_DoubleJoinOK(t *testing.T) {
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
defer ts2.Close()
|
|
|
|
defer ts2.Close()
|
|
|
|
|
|
|
|
|
|
|
|
j, err := Join([]string{ts1.URL, ts2.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
j, err := Join("127.0.0.1", []string{ts1.URL, ts2.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
@ -151,7 +151,7 @@ func Test_DoubleJoinOKSecondNode(t *testing.T) {
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
defer ts2.Close()
|
|
|
|
defer ts2.Close()
|
|
|
|
|
|
|
|
|
|
|
|
j, err := Join([]string{ts1.URL, ts2.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
j, err := Join("", []string{ts1.URL, ts2.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
@ -172,7 +172,7 @@ func Test_DoubleJoinOKSecondNodeRedirect(t *testing.T) {
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
defer ts2.Close()
|
|
|
|
defer ts2.Close()
|
|
|
|
|
|
|
|
|
|
|
|
j, err := Join([]string{ts2.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
j, err := Join("127.0.0.1", []string{ts2.URL}, "id0", "127.0.0.1:9090", true, nil,
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
numAttempts, attemptInterval, nil)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
|
t.Fatalf("failed to join a single node: %s", err.Error())
|
|
|
|