|
@@ -31,7 +31,7 @@ import (
|
|
|
// and increase success count in stats.
|
|
// and increase success count in stats.
|
|
|
func TestPipelineSend(t *testing.T) {
|
|
func TestPipelineSend(t *testing.T) {
|
|
|
tr := &roundTripperRecorder{}
|
|
tr := &roundTripperRecorder{}
|
|
|
- picker := mustNewURLPicker(t, []string{"http://localhost:7001"})
|
|
|
|
|
|
|
+ picker := mustNewURLPicker(t, []string{"http://localhost:2380"})
|
|
|
fs := &stats.FollowerStats{}
|
|
fs := &stats.FollowerStats{}
|
|
|
p := newPipeline(tr, picker, types.ID(1), types.ID(1), fs, &fakeRaft{}, nil)
|
|
p := newPipeline(tr, picker, types.ID(1), types.ID(1), fs, &fakeRaft{}, nil)
|
|
|
|
|
|
|
@@ -50,7 +50,7 @@ func TestPipelineSend(t *testing.T) {
|
|
|
|
|
|
|
|
func TestPipelineExceedMaximalServing(t *testing.T) {
|
|
func TestPipelineExceedMaximalServing(t *testing.T) {
|
|
|
tr := newRoundTripperBlocker()
|
|
tr := newRoundTripperBlocker()
|
|
|
- picker := mustNewURLPicker(t, []string{"http://localhost:7001"})
|
|
|
|
|
|
|
+ picker := mustNewURLPicker(t, []string{"http://localhost:2380"})
|
|
|
fs := &stats.FollowerStats{}
|
|
fs := &stats.FollowerStats{}
|
|
|
p := newPipeline(tr, picker, types.ID(1), types.ID(1), fs, &fakeRaft{}, nil)
|
|
p := newPipeline(tr, picker, types.ID(1), types.ID(1), fs, &fakeRaft{}, nil)
|
|
|
|
|
|
|
@@ -90,7 +90,7 @@ func TestPipelineExceedMaximalServing(t *testing.T) {
|
|
|
// TestPipelineSendFailed tests that when send func meets the post error,
|
|
// TestPipelineSendFailed tests that when send func meets the post error,
|
|
|
// it increases fail count in stats.
|
|
// it increases fail count in stats.
|
|
|
func TestPipelineSendFailed(t *testing.T) {
|
|
func TestPipelineSendFailed(t *testing.T) {
|
|
|
- picker := mustNewURLPicker(t, []string{"http://localhost:7001"})
|
|
|
|
|
|
|
+ picker := mustNewURLPicker(t, []string{"http://localhost:2380"})
|
|
|
fs := &stats.FollowerStats{}
|
|
fs := &stats.FollowerStats{}
|
|
|
p := newPipeline(newRespRoundTripper(0, errors.New("blah")), picker, types.ID(1), types.ID(1), fs, &fakeRaft{}, nil)
|
|
p := newPipeline(newRespRoundTripper(0, errors.New("blah")), picker, types.ID(1), types.ID(1), fs, &fakeRaft{}, nil)
|
|
|
|
|
|
|
@@ -106,7 +106,7 @@ func TestPipelineSendFailed(t *testing.T) {
|
|
|
|
|
|
|
|
func TestPipelinePost(t *testing.T) {
|
|
func TestPipelinePost(t *testing.T) {
|
|
|
tr := &roundTripperRecorder{}
|
|
tr := &roundTripperRecorder{}
|
|
|
- picker := mustNewURLPicker(t, []string{"http://localhost:7001"})
|
|
|
|
|
|
|
+ picker := mustNewURLPicker(t, []string{"http://localhost:2380"})
|
|
|
p := newPipeline(tr, picker, types.ID(1), types.ID(1), nil, &fakeRaft{}, nil)
|
|
p := newPipeline(tr, picker, types.ID(1), types.ID(1), nil, &fakeRaft{}, nil)
|
|
|
if err := p.post([]byte("some data")); err != nil {
|
|
if err := p.post([]byte("some data")); err != nil {
|
|
|
t.Fatalf("unexpect post error: %v", err)
|
|
t.Fatalf("unexpect post error: %v", err)
|
|
@@ -116,8 +116,8 @@ func TestPipelinePost(t *testing.T) {
|
|
|
if g := tr.Request().Method; g != "POST" {
|
|
if g := tr.Request().Method; g != "POST" {
|
|
|
t.Errorf("method = %s, want %s", g, "POST")
|
|
t.Errorf("method = %s, want %s", g, "POST")
|
|
|
}
|
|
}
|
|
|
- if g := tr.Request().URL.String(); g != "http://localhost:7001/raft" {
|
|
|
|
|
- t.Errorf("url = %s, want %s", g, "http://localhost:7001/raft")
|
|
|
|
|
|
|
+ if g := tr.Request().URL.String(); g != "http://localhost:2380/raft" {
|
|
|
|
|
+ t.Errorf("url = %s, want %s", g, "http://localhost:2380/raft")
|
|
|
}
|
|
}
|
|
|
if g := tr.Request().Header.Get("Content-Type"); g != "application/protobuf" {
|
|
if g := tr.Request().Header.Get("Content-Type"); g != "application/protobuf" {
|
|
|
t.Errorf("content type = %s, want %s", g, "application/protobuf")
|
|
t.Errorf("content type = %s, want %s", g, "application/protobuf")
|
|
@@ -141,10 +141,10 @@ func TestPipelinePostBad(t *testing.T) {
|
|
|
err error
|
|
err error
|
|
|
}{
|
|
}{
|
|
|
// RoundTrip returns error
|
|
// RoundTrip returns error
|
|
|
- {"http://localhost:7001", 0, errors.New("blah")},
|
|
|
|
|
|
|
+ {"http://localhost:2380", 0, errors.New("blah")},
|
|
|
// unexpected response status code
|
|
// unexpected response status code
|
|
|
- {"http://localhost:7001", http.StatusOK, nil},
|
|
|
|
|
- {"http://localhost:7001", http.StatusCreated, nil},
|
|
|
|
|
|
|
+ {"http://localhost:2380", http.StatusOK, nil},
|
|
|
|
|
+ {"http://localhost:2380", http.StatusCreated, nil},
|
|
|
}
|
|
}
|
|
|
for i, tt := range tests {
|
|
for i, tt := range tests {
|
|
|
picker := mustNewURLPicker(t, []string{tt.u})
|
|
picker := mustNewURLPicker(t, []string{tt.u})
|
|
@@ -164,8 +164,8 @@ func TestPipelinePostErrorc(t *testing.T) {
|
|
|
code int
|
|
code int
|
|
|
err error
|
|
err error
|
|
|
}{
|
|
}{
|
|
|
- {"http://localhost:7001", http.StatusForbidden, nil},
|
|
|
|
|
- {"http://localhost:7001", http.StatusPreconditionFailed, nil},
|
|
|
|
|
|
|
+ {"http://localhost:2380", http.StatusForbidden, nil},
|
|
|
|
|
+ {"http://localhost:2380", http.StatusPreconditionFailed, nil},
|
|
|
}
|
|
}
|
|
|
for i, tt := range tests {
|
|
for i, tt := range tests {
|
|
|
picker := mustNewURLPicker(t, []string{tt.u})
|
|
picker := mustNewURLPicker(t, []string{tt.u})
|