mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #3356 from xiang90/travis
*: test gofmt with -s and fix reported issues
This commit is contained in:
commit
044b23c3ca
@ -333,8 +333,8 @@ func TestHTTPClusterClientDo(t *testing.T) {
|
||||
endpoints: []url.URL{fakeURL, fakeURL},
|
||||
clientFactory: newStaticHTTPClientFactory(
|
||||
[]staticHTTPResponse{
|
||||
staticHTTPResponse{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
staticHTTPResponse{err: fakeErr},
|
||||
{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
{err: fakeErr},
|
||||
},
|
||||
),
|
||||
rand: rand.New(rand.NewSource(0)),
|
||||
@ -348,8 +348,8 @@ func TestHTTPClusterClientDo(t *testing.T) {
|
||||
endpoints: []url.URL{fakeURL, fakeURL},
|
||||
clientFactory: newStaticHTTPClientFactory(
|
||||
[]staticHTTPResponse{
|
||||
staticHTTPResponse{err: fakeErr},
|
||||
staticHTTPResponse{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
{err: fakeErr},
|
||||
{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
},
|
||||
),
|
||||
rand: rand.New(rand.NewSource(0)),
|
||||
@ -364,8 +364,8 @@ func TestHTTPClusterClientDo(t *testing.T) {
|
||||
endpoints: []url.URL{fakeURL, fakeURL},
|
||||
clientFactory: newStaticHTTPClientFactory(
|
||||
[]staticHTTPResponse{
|
||||
staticHTTPResponse{err: context.Canceled},
|
||||
staticHTTPResponse{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
{err: context.Canceled},
|
||||
{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
},
|
||||
),
|
||||
rand: rand.New(rand.NewSource(0)),
|
||||
@ -389,8 +389,8 @@ func TestHTTPClusterClientDo(t *testing.T) {
|
||||
endpoints: []url.URL{fakeURL, fakeURL},
|
||||
clientFactory: newStaticHTTPClientFactory(
|
||||
[]staticHTTPResponse{
|
||||
staticHTTPResponse{err: fakeErr},
|
||||
staticHTTPResponse{err: fakeErr},
|
||||
{err: fakeErr},
|
||||
{err: fakeErr},
|
||||
},
|
||||
),
|
||||
rand: rand.New(rand.NewSource(0)),
|
||||
@ -404,8 +404,8 @@ func TestHTTPClusterClientDo(t *testing.T) {
|
||||
endpoints: []url.URL{fakeURL, fakeURL},
|
||||
clientFactory: newStaticHTTPClientFactory(
|
||||
[]staticHTTPResponse{
|
||||
staticHTTPResponse{resp: http.Response{StatusCode: http.StatusBadGateway}},
|
||||
staticHTTPResponse{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
{resp: http.Response{StatusCode: http.StatusBadGateway}},
|
||||
{resp: http.Response{StatusCode: http.StatusTeapot}},
|
||||
},
|
||||
),
|
||||
rand: rand.New(rand.NewSource(0)),
|
||||
@ -513,7 +513,7 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
|
||||
checkRedirect: func(int) error { return ErrTooManyRedirects },
|
||||
client: &multiStaticHTTPClient{
|
||||
responses: []staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
err: errors.New("fail!"),
|
||||
},
|
||||
},
|
||||
@ -526,7 +526,7 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
|
||||
checkRedirect: func(int) error { return ErrTooManyRedirects },
|
||||
client: &multiStaticHTTPClient{
|
||||
responses: []staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTeapot,
|
||||
},
|
||||
@ -546,13 +546,13 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
|
||||
},
|
||||
client: &multiStaticHTTPClient{
|
||||
responses: []staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTemporaryRedirect,
|
||||
Header: http.Header{"Location": []string{"http://example.com"}},
|
||||
},
|
||||
},
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTeapot,
|
||||
},
|
||||
@ -572,19 +572,19 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
|
||||
},
|
||||
client: &multiStaticHTTPClient{
|
||||
responses: []staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTemporaryRedirect,
|
||||
Header: http.Header{"Location": []string{"http://example.com"}},
|
||||
},
|
||||
},
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTemporaryRedirect,
|
||||
Header: http.Header{"Location": []string{"http://example.com"}},
|
||||
},
|
||||
},
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTeapot,
|
||||
},
|
||||
@ -604,19 +604,19 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
|
||||
},
|
||||
client: &multiStaticHTTPClient{
|
||||
responses: []staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTemporaryRedirect,
|
||||
Header: http.Header{"Location": []string{"http://example.com"}},
|
||||
},
|
||||
},
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTemporaryRedirect,
|
||||
Header: http.Header{"Location": []string{"http://example.com"}},
|
||||
},
|
||||
},
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTeapot,
|
||||
},
|
||||
@ -631,7 +631,7 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
|
||||
checkRedirect: func(int) error { return ErrTooManyRedirects },
|
||||
client: &multiStaticHTTPClient{
|
||||
responses: []staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTemporaryRedirect,
|
||||
},
|
||||
@ -646,7 +646,7 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
|
||||
checkRedirect: func(int) error { return ErrTooManyRedirects },
|
||||
client: &multiStaticHTTPClient{
|
||||
responses: []staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{
|
||||
StatusCode: http.StatusTemporaryRedirect,
|
||||
Header: http.Header{"Location": []string{":"}},
|
||||
@ -714,7 +714,7 @@ func TestDefaultCheckRedirect(t *testing.T) {
|
||||
|
||||
func TestHTTPClusterClientSync(t *testing.T) {
|
||||
cf := newStaticHTTPClientFactory([]staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
|
||||
body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
|
||||
},
|
||||
@ -761,7 +761,7 @@ func TestHTTPClusterClientSync(t *testing.T) {
|
||||
|
||||
func TestHTTPClusterClientSyncFail(t *testing.T) {
|
||||
cf := newStaticHTTPClientFactory([]staticHTTPResponse{
|
||||
staticHTTPResponse{err: errors.New("fail!")},
|
||||
{err: errors.New("fail!")},
|
||||
})
|
||||
|
||||
hc := &httpClusterClient{
|
||||
@ -792,7 +792,7 @@ func TestHTTPClusterClientSyncFail(t *testing.T) {
|
||||
|
||||
func TestHTTPClusterClientAutoSyncCancelContext(t *testing.T) {
|
||||
cf := newStaticHTTPClientFactory([]staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
|
||||
body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
|
||||
},
|
||||
@ -817,7 +817,7 @@ func TestHTTPClusterClientAutoSyncCancelContext(t *testing.T) {
|
||||
|
||||
func TestHTTPClusterClientAutoSyncFail(t *testing.T) {
|
||||
cf := newStaticHTTPClientFactory([]staticHTTPResponse{
|
||||
staticHTTPResponse{err: errors.New("fail!")},
|
||||
{err: errors.New("fail!")},
|
||||
})
|
||||
|
||||
hc := &httpClusterClient{
|
||||
@ -839,15 +839,15 @@ func TestHTTPClusterClientAutoSyncFail(t *testing.T) {
|
||||
// it gets the exactly same member list as before.
|
||||
func TestHTTPClusterClientSyncPinEndpoint(t *testing.T) {
|
||||
cf := newStaticHTTPClientFactory([]staticHTTPResponse{
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
|
||||
body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
|
||||
},
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
|
||||
body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
|
||||
},
|
||||
staticHTTPResponse{
|
||||
{
|
||||
resp: http.Response{StatusCode: http.StatusOK, Header: http.Header{"Content-Type": []string{"application/json"}}},
|
||||
body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
|
||||
},
|
||||
@ -878,10 +878,10 @@ func TestHTTPClusterClientSyncPinEndpoint(t *testing.T) {
|
||||
func TestHTTPClusterClientResetFail(t *testing.T) {
|
||||
tests := [][]string{
|
||||
// need at least one endpoint
|
||||
[]string{},
|
||||
{},
|
||||
|
||||
// urls must be valid
|
||||
[]string{":"},
|
||||
{":"},
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
|
@ -221,7 +221,7 @@ func TestWaitAction(t *testing.T) {
|
||||
|
||||
func TestSetAction(t *testing.T) {
|
||||
wantHeader := http.Header(map[string][]string{
|
||||
"Content-Type": []string{"application/x-www-form-urlencoded"},
|
||||
"Content-Type": {"application/x-www-form-urlencoded"},
|
||||
})
|
||||
|
||||
tests := []struct {
|
||||
@ -412,7 +412,7 @@ func TestSetAction(t *testing.T) {
|
||||
|
||||
func TestCreateInOrderAction(t *testing.T) {
|
||||
wantHeader := http.Header(map[string][]string{
|
||||
"Content-Type": []string{"application/x-www-form-urlencoded"},
|
||||
"Content-Type": {"application/x-www-form-urlencoded"},
|
||||
})
|
||||
|
||||
tests := []struct {
|
||||
@ -513,7 +513,7 @@ func TestCreateInOrderAction(t *testing.T) {
|
||||
|
||||
func TestDeleteAction(t *testing.T) {
|
||||
wantHeader := http.Header(map[string][]string{
|
||||
"Content-Type": []string{"application/x-www-form-urlencoded"},
|
||||
"Content-Type": {"application/x-www-form-urlencoded"},
|
||||
})
|
||||
|
||||
tests := []struct {
|
||||
@ -1213,7 +1213,7 @@ func TestHTTPKeysAPIGetResponse(t *testing.T) {
|
||||
Node: &Node{
|
||||
Key: "/pants/foo/bar",
|
||||
Nodes: []*Node{
|
||||
&Node{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: 21, ModifiedIndex: 25},
|
||||
{Key: "/pants/foo/bar/baz", Value: "snarf", CreatedIndex: 21, ModifiedIndex: 25},
|
||||
},
|
||||
CreatedIndex: uint64(19),
|
||||
ModifiedIndex: uint64(25),
|
||||
|
@ -48,8 +48,8 @@ func TestMembersAPIActionAdd(t *testing.T) {
|
||||
ep := url.URL{Scheme: "http", Host: "example.com"}
|
||||
act := &membersAPIActionAdd{
|
||||
peerURLs: types.URLs([]url.URL{
|
||||
url.URL{Scheme: "https", Host: "127.0.0.1:8081"},
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:8080"},
|
||||
{Scheme: "https", Host: "127.0.0.1:8081"},
|
||||
{Scheme: "http", Host: "127.0.0.1:8080"},
|
||||
}),
|
||||
}
|
||||
|
||||
@ -75,8 +75,8 @@ func TestMembersAPIActionUpdate(t *testing.T) {
|
||||
act := &membersAPIActionUpdate{
|
||||
memberID: "0xabcd",
|
||||
peerURLs: types.URLs([]url.URL{
|
||||
url.URL{Scheme: "https", Host: "127.0.0.1:8081"},
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:8080"},
|
||||
{Scheme: "https", Host: "127.0.0.1:8081"},
|
||||
{Scheme: "http", Host: "127.0.0.1:8080"},
|
||||
}),
|
||||
}
|
||||
|
||||
@ -289,8 +289,8 @@ func TestMemberCollectionUnmarshal(t *testing.T) {
|
||||
func TestMemberCreateRequestMarshal(t *testing.T) {
|
||||
req := memberCreateOrUpdateRequest{
|
||||
PeerURLs: types.URLs([]url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:8081"},
|
||||
url.URL{Scheme: "https", Host: "127.0.0.1:8080"},
|
||||
{Scheme: "http", Host: "127.0.0.1:8081"},
|
||||
{Scheme: "https", Host: "127.0.0.1:8080"},
|
||||
}),
|
||||
}
|
||||
want := []byte(`{"peerURLs":["http://127.0.0.1:8081","https://127.0.0.1:8080"]}`)
|
||||
@ -308,7 +308,7 @@ func TestMemberCreateRequestMarshal(t *testing.T) {
|
||||
func TestHTTPMembersAPIAddSuccess(t *testing.T) {
|
||||
wantAction := &membersAPIActionAdd{
|
||||
peerURLs: types.URLs([]url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:7002"},
|
||||
{Scheme: "http", Host: "127.0.0.1:7002"},
|
||||
}),
|
||||
}
|
||||
|
||||
@ -473,7 +473,7 @@ func TestHTTPMembersAPIListSuccess(t *testing.T) {
|
||||
}
|
||||
|
||||
wantResponseMembers := []Member{
|
||||
Member{
|
||||
{
|
||||
ID: "94088180e21eb87b",
|
||||
Name: "node2",
|
||||
PeerURLs: []string{"http://127.0.0.1:7002"},
|
||||
|
@ -36,40 +36,40 @@ func TestSRVDiscover(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.2", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.3", Port: 2480},
|
||||
{Target: "10.0.0.1", Port: 2480},
|
||||
{Target: "10.0.0.2", Port: 2480},
|
||||
{Target: "10.0.0.3", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{},
|
||||
[]string{"https://10.0.0.1:2480", "https://10.0.0.2:2480", "https://10.0.0.3:2480"},
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.2", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.3", Port: 2480},
|
||||
{Target: "10.0.0.1", Port: 2480},
|
||||
{Target: "10.0.0.2", Port: 2480},
|
||||
{Target: "10.0.0.3", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 7001},
|
||||
{Target: "10.0.0.1", Port: 7001},
|
||||
},
|
||||
[]string{"https://10.0.0.1:2480", "https://10.0.0.2:2480", "https://10.0.0.3:2480", "http://10.0.0.1:7001"},
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.2", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.3", Port: 2480},
|
||||
{Target: "10.0.0.1", Port: 2480},
|
||||
{Target: "10.0.0.2", Port: 2480},
|
||||
{Target: "10.0.0.3", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 7001},
|
||||
{Target: "10.0.0.1", Port: 7001},
|
||||
},
|
||||
[]string{"https://10.0.0.1:2480", "https://10.0.0.2:2480", "https://10.0.0.3:2480", "http://10.0.0.1:7001"},
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "a.example.com", Port: 2480},
|
||||
&net.SRV{Target: "b.example.com", Port: 2480},
|
||||
&net.SRV{Target: "c.example.com", Port: 2480},
|
||||
{Target: "a.example.com", Port: 2480},
|
||||
{Target: "b.example.com", Port: 2480},
|
||||
{Target: "c.example.com", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{},
|
||||
[]string{"https://a.example.com:2480", "https://b.example.com:2480", "https://c.example.com:2480"},
|
||||
|
@ -47,9 +47,9 @@ func TestSRVGetCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.2", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.3", Port: 2480},
|
||||
{Target: "10.0.0.1", Port: 2480},
|
||||
{Target: "10.0.0.2", Port: 2480},
|
||||
{Target: "10.0.0.3", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{},
|
||||
nil,
|
||||
@ -59,12 +59,12 @@ func TestSRVGetCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.2", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.3", Port: 2480},
|
||||
{Target: "10.0.0.1", Port: 2480},
|
||||
{Target: "10.0.0.2", Port: 2480},
|
||||
{Target: "10.0.0.3", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2380},
|
||||
{Target: "10.0.0.1", Port: 2380},
|
||||
},
|
||||
nil,
|
||||
nil,
|
||||
@ -72,12 +72,12 @@ func TestSRVGetCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.2", Port: 2480},
|
||||
&net.SRV{Target: "10.0.0.3", Port: 2480},
|
||||
{Target: "10.0.0.1", Port: 2480},
|
||||
{Target: "10.0.0.2", Port: 2480},
|
||||
{Target: "10.0.0.3", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "10.0.0.1", Port: 2380},
|
||||
{Target: "10.0.0.1", Port: 2380},
|
||||
},
|
||||
[]string{"https://10.0.0.1:2480"},
|
||||
nil,
|
||||
@ -86,9 +86,9 @@ func TestSRVGetCluster(t *testing.T) {
|
||||
// matching local member with resolved addr and return unresolved hostnames
|
||||
{
|
||||
[]*net.SRV{
|
||||
&net.SRV{Target: "1.example.com.", Port: 2480},
|
||||
&net.SRV{Target: "2.example.com.", Port: 2480},
|
||||
&net.SRV{Target: "3.example.com.", Port: 2480},
|
||||
{Target: "1.example.com.", Port: 2480},
|
||||
{Target: "2.example.com.", Port: 2480},
|
||||
{Target: "3.example.com.", Port: 2480},
|
||||
},
|
||||
nil,
|
||||
[]string{"https://10.0.0.1:2480"},
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
func TestErrorWriteTo(t *testing.T) {
|
||||
for k, _ := range errors {
|
||||
for k := range errors {
|
||||
err := NewError(k, "", 1)
|
||||
rr := httptest.NewRecorder()
|
||||
err.WriteTo(rr)
|
||||
@ -38,8 +38,8 @@ func TestErrorWriteTo(t *testing.T) {
|
||||
}
|
||||
|
||||
wheader := http.Header(map[string][]string{
|
||||
"Content-Type": []string{"application/json"},
|
||||
"X-Etcd-Index": []string{"1"},
|
||||
"Content-Type": {"application/json"},
|
||||
"X-Etcd-Index": {"1"},
|
||||
})
|
||||
|
||||
if !reflect.DeepEqual(wheader, rr.HeaderMap) {
|
||||
|
@ -29,12 +29,12 @@ func NewAuthCommands() cli.Command {
|
||||
Name: "auth",
|
||||
Usage: "overall auth controls",
|
||||
Subcommands: []cli.Command{
|
||||
cli.Command{
|
||||
{
|
||||
Name: "enable",
|
||||
Usage: "enable auth access controls",
|
||||
Action: actionAuthEnable,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "disable",
|
||||
Usage: "disable auth access controls",
|
||||
Action: actionAuthDisable,
|
||||
|
@ -29,22 +29,22 @@ func NewMemberCommand() cli.Command {
|
||||
Name: "member",
|
||||
Usage: "member add, remove and list subcommands",
|
||||
Subcommands: []cli.Command{
|
||||
cli.Command{
|
||||
{
|
||||
Name: "list",
|
||||
Usage: "enumerate existing cluster members",
|
||||
Action: actionMemberList,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "add",
|
||||
Usage: "add a new member to the etcd cluster",
|
||||
Action: actionMemberAdd,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "remove",
|
||||
Usage: "remove an existing member from the etcd cluster",
|
||||
Action: actionMemberRemove,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "update",
|
||||
Usage: "update an existing member in the etcd cluster",
|
||||
Action: actionMemberUpdate,
|
||||
|
@ -31,27 +31,27 @@ func NewRoleCommands() cli.Command {
|
||||
Name: "role",
|
||||
Usage: "role add, grant and revoke subcommands",
|
||||
Subcommands: []cli.Command{
|
||||
cli.Command{
|
||||
{
|
||||
Name: "add",
|
||||
Usage: "add a new role for the etcd cluster",
|
||||
Action: actionRoleAdd,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "get",
|
||||
Usage: "get details for a role",
|
||||
Action: actionRoleGet,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "list",
|
||||
Usage: "list all roles",
|
||||
Action: actionRoleList,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "remove",
|
||||
Usage: "remove a role from the etcd cluster",
|
||||
Action: actionRoleRemove,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "grant",
|
||||
Usage: "grant path matches to an etcd role",
|
||||
Flags: []cli.Flag{
|
||||
@ -62,7 +62,7 @@ func NewRoleCommands() cli.Command {
|
||||
},
|
||||
Action: actionRoleGrant,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "revoke",
|
||||
Usage: "revoke path matches for an etcd role",
|
||||
Flags: []cli.Flag{
|
||||
|
@ -32,39 +32,39 @@ func NewUserCommands() cli.Command {
|
||||
Name: "user",
|
||||
Usage: "user add, grant and revoke subcommands",
|
||||
Subcommands: []cli.Command{
|
||||
cli.Command{
|
||||
{
|
||||
Name: "add",
|
||||
Usage: "add a new user for the etcd cluster",
|
||||
Action: actionUserAdd,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "get",
|
||||
Usage: "get details for a user",
|
||||
Action: actionUserGet,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "list",
|
||||
Usage: "list all current users",
|
||||
Action: actionUserList,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "remove",
|
||||
Usage: "remove a user for the etcd cluster",
|
||||
Action: actionUserRemove,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "grant",
|
||||
Usage: "grant roles to an etcd user",
|
||||
Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}},
|
||||
Action: actionUserGrant,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "revoke",
|
||||
Usage: "revoke roles for an etcd user",
|
||||
Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}},
|
||||
Action: actionUserRevoke,
|
||||
},
|
||||
cli.Command{
|
||||
{
|
||||
Name: "passwd",
|
||||
Usage: "change password for a user",
|
||||
Action: actionUserPasswd,
|
||||
|
@ -184,19 +184,19 @@ func TestConfigParsingV1Flags(t *testing.T) {
|
||||
|
||||
func TestConfigParsingConflictClusteringFlags(t *testing.T) {
|
||||
conflictArgs := [][]string{
|
||||
[]string{
|
||||
{
|
||||
"-initial-cluster=0=localhost:8000",
|
||||
"-discovery=http://example.com/abc",
|
||||
},
|
||||
[]string{
|
||||
{
|
||||
"-discovery-srv=example.com",
|
||||
"-discovery=http://example.com/abc",
|
||||
},
|
||||
[]string{
|
||||
{
|
||||
"-initial-cluster=0=localhost:8000",
|
||||
"-discovery-srv=example.com",
|
||||
},
|
||||
[]string{
|
||||
{
|
||||
"-initial-cluster=0=localhost:8000",
|
||||
"-discovery=http://example.com/abc",
|
||||
"-discovery-srv=example.com",
|
||||
|
@ -196,10 +196,10 @@ func TestAllUsers(t *testing.T) {
|
||||
Action: etcdstore.Get,
|
||||
Node: &etcdstore.NodeExtern{
|
||||
Nodes: etcdstore.NodeExterns([]*etcdstore.NodeExtern{
|
||||
&etcdstore.NodeExtern{
|
||||
{
|
||||
Key: StorePermsPrefix + "/users/cat",
|
||||
},
|
||||
&etcdstore.NodeExtern{
|
||||
{
|
||||
Key: StorePermsPrefix + "/users/dog",
|
||||
},
|
||||
}),
|
||||
@ -260,10 +260,10 @@ func TestAllRoles(t *testing.T) {
|
||||
Action: etcdstore.Get,
|
||||
Node: &etcdstore.NodeExtern{
|
||||
Nodes: etcdstore.NodeExterns([]*etcdstore.NodeExtern{
|
||||
&etcdstore.NodeExtern{
|
||||
{
|
||||
Key: StorePermsPrefix + "/roles/animal",
|
||||
},
|
||||
&etcdstore.NodeExtern{
|
||||
{
|
||||
Key: StorePermsPrefix + "/roles/human",
|
||||
},
|
||||
}),
|
||||
|
@ -198,7 +198,7 @@ func (c *cluster) String() string {
|
||||
}
|
||||
fmt.Fprintf(b, "Members:[%s] ", strings.Join(ms, " "))
|
||||
var ids []string
|
||||
for id, _ := range c.removed {
|
||||
for id := range c.removed {
|
||||
ids = append(ids, fmt.Sprintf("%s", id))
|
||||
}
|
||||
fmt.Fprintf(b, "RemovedMemberIDs:[%s]}", strings.Join(ids, " "))
|
||||
|
@ -472,19 +472,19 @@ func TestClusterAddMember(t *testing.T) {
|
||||
func TestClusterMembers(t *testing.T) {
|
||||
cls := &cluster{
|
||||
members: map[types.ID]*Member{
|
||||
1: &Member{ID: 1},
|
||||
20: &Member{ID: 20},
|
||||
100: &Member{ID: 100},
|
||||
5: &Member{ID: 5},
|
||||
50: &Member{ID: 50},
|
||||
1: {ID: 1},
|
||||
20: {ID: 20},
|
||||
100: {ID: 100},
|
||||
5: {ID: 5},
|
||||
50: {ID: 50},
|
||||
},
|
||||
}
|
||||
w := []*Member{
|
||||
&Member{ID: 1},
|
||||
&Member{ID: 5},
|
||||
&Member{ID: 20},
|
||||
&Member{ID: 50},
|
||||
&Member{ID: 100},
|
||||
{ID: 1},
|
||||
{ID: 5},
|
||||
{ID: 20},
|
||||
{ID: 50},
|
||||
{ID: 100},
|
||||
}
|
||||
if g := cls.Members(); !reflect.DeepEqual(g, w) {
|
||||
t.Fatalf("Members()=%#v, want %#v", g, w)
|
||||
|
@ -29,7 +29,7 @@ func TestDecideClusterVersion(t *testing.T) {
|
||||
wdver *semver.Version
|
||||
}{
|
||||
{
|
||||
map[string]*version.Versions{"a": &version.Versions{Server: "2.0.0"}},
|
||||
map[string]*version.Versions{"a": {Server: "2.0.0"}},
|
||||
semver.Must(semver.NewVersion("2.0.0")),
|
||||
},
|
||||
// unknow
|
||||
@ -38,15 +38,15 @@ func TestDecideClusterVersion(t *testing.T) {
|
||||
nil,
|
||||
},
|
||||
{
|
||||
map[string]*version.Versions{"a": &version.Versions{Server: "2.0.0"}, "b": &version.Versions{Server: "2.1.0"}, "c": &version.Versions{Server: "2.1.0"}},
|
||||
map[string]*version.Versions{"a": {Server: "2.0.0"}, "b": {Server: "2.1.0"}, "c": {Server: "2.1.0"}},
|
||||
semver.Must(semver.NewVersion("2.0.0")),
|
||||
},
|
||||
{
|
||||
map[string]*version.Versions{"a": &version.Versions{Server: "2.1.0"}, "b": &version.Versions{Server: "2.1.0"}, "c": &version.Versions{Server: "2.1.0"}},
|
||||
map[string]*version.Versions{"a": {Server: "2.1.0"}, "b": {Server: "2.1.0"}, "c": {Server: "2.1.0"}},
|
||||
semver.Must(semver.NewVersion("2.1.0")),
|
||||
},
|
||||
{
|
||||
map[string]*version.Versions{"a": nil, "b": &version.Versions{Server: "2.1.0"}, "c": &version.Versions{Server: "2.1.0"}},
|
||||
map[string]*version.Versions{"a": nil, "b": {Server: "2.1.0"}, "c": {Server: "2.1.0"}},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
@ -69,9 +69,9 @@ func TestIsCompatibleWithVers(t *testing.T) {
|
||||
// too low
|
||||
{
|
||||
map[string]*version.Versions{
|
||||
"a": &version.Versions{Server: "2.0.0", Cluster: "not_decided"},
|
||||
"b": &version.Versions{Server: "2.1.0", Cluster: "2.1.0"},
|
||||
"c": &version.Versions{Server: "2.1.0", Cluster: "2.1.0"},
|
||||
"a": {Server: "2.0.0", Cluster: "not_decided"},
|
||||
"b": {Server: "2.1.0", Cluster: "2.1.0"},
|
||||
"c": {Server: "2.1.0", Cluster: "2.1.0"},
|
||||
},
|
||||
0xa,
|
||||
semver.Must(semver.NewVersion("2.0.0")), semver.Must(semver.NewVersion("2.0.0")),
|
||||
@ -79,9 +79,9 @@ func TestIsCompatibleWithVers(t *testing.T) {
|
||||
},
|
||||
{
|
||||
map[string]*version.Versions{
|
||||
"a": &version.Versions{Server: "2.1.0", Cluster: "not_decided"},
|
||||
"b": &version.Versions{Server: "2.1.0", Cluster: "2.1.0"},
|
||||
"c": &version.Versions{Server: "2.1.0", Cluster: "2.1.0"},
|
||||
"a": {Server: "2.1.0", Cluster: "not_decided"},
|
||||
"b": {Server: "2.1.0", Cluster: "2.1.0"},
|
||||
"c": {Server: "2.1.0", Cluster: "2.1.0"},
|
||||
},
|
||||
0xa,
|
||||
semver.Must(semver.NewVersion("2.0.0")), semver.Must(semver.NewVersion("2.1.0")),
|
||||
@ -90,9 +90,9 @@ func TestIsCompatibleWithVers(t *testing.T) {
|
||||
// too high
|
||||
{
|
||||
map[string]*version.Versions{
|
||||
"a": &version.Versions{Server: "2.2.0", Cluster: "not_decided"},
|
||||
"b": &version.Versions{Server: "2.0.0", Cluster: "2.0.0"},
|
||||
"c": &version.Versions{Server: "2.0.0", Cluster: "2.0.0"},
|
||||
"a": {Server: "2.2.0", Cluster: "not_decided"},
|
||||
"b": {Server: "2.0.0", Cluster: "2.0.0"},
|
||||
"c": {Server: "2.0.0", Cluster: "2.0.0"},
|
||||
},
|
||||
0xa,
|
||||
semver.Must(semver.NewVersion("2.1.0")), semver.Must(semver.NewVersion("2.2.0")),
|
||||
@ -101,9 +101,9 @@ func TestIsCompatibleWithVers(t *testing.T) {
|
||||
// cannot get b's version, expect ok
|
||||
{
|
||||
map[string]*version.Versions{
|
||||
"a": &version.Versions{Server: "2.1.0", Cluster: "not_decided"},
|
||||
"a": {Server: "2.1.0", Cluster: "not_decided"},
|
||||
"b": nil,
|
||||
"c": &version.Versions{Server: "2.1.0", Cluster: "2.1.0"},
|
||||
"c": {Server: "2.1.0", Cluster: "2.1.0"},
|
||||
},
|
||||
0xa,
|
||||
semver.Must(semver.NewVersion("2.0.0")), semver.Must(semver.NewVersion("2.1.0")),
|
||||
@ -112,7 +112,7 @@ func TestIsCompatibleWithVers(t *testing.T) {
|
||||
// cannot get b and c's version, expect not ok
|
||||
{
|
||||
map[string]*version.Versions{
|
||||
"a": &version.Versions{Server: "2.1.0", Cluster: "not_decided"},
|
||||
"a": {Server: "2.1.0", Cluster: "not_decided"},
|
||||
"b": nil,
|
||||
"c": nil,
|
||||
},
|
||||
|
@ -817,7 +817,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, membersPrefix),
|
||||
Method: "POST",
|
||||
Body: ioutil.NopCloser(strings.NewReader("bad json")),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&resServer{},
|
||||
|
||||
@ -829,7 +829,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, membersPrefix),
|
||||
Method: "POST",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/bad"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/bad"}},
|
||||
},
|
||||
&errServer{},
|
||||
|
||||
@ -841,7 +841,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, membersPrefix),
|
||||
Method: "POST",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://a"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{},
|
||||
|
||||
@ -853,7 +853,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, membersPrefix),
|
||||
Method: "POST",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{
|
||||
errors.New("Error while adding a member"),
|
||||
@ -867,7 +867,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, membersPrefix),
|
||||
Method: "POST",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{
|
||||
etcdserver.ErrIDExists,
|
||||
@ -881,7 +881,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, membersPrefix),
|
||||
Method: "POST",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{
|
||||
etcdserver.ErrPeerURLexists,
|
||||
@ -951,7 +951,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, path.Join(membersPrefix, "0")),
|
||||
Method: "PUT",
|
||||
Body: ioutil.NopCloser(strings.NewReader("bad json")),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&resServer{},
|
||||
|
||||
@ -963,7 +963,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, path.Join(membersPrefix, "0")),
|
||||
Method: "PUT",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/bad"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/bad"}},
|
||||
},
|
||||
&errServer{},
|
||||
|
||||
@ -975,7 +975,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, path.Join(membersPrefix, "0")),
|
||||
Method: "PUT",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://a"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{},
|
||||
|
||||
@ -987,7 +987,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, path.Join(membersPrefix, "0")),
|
||||
Method: "PUT",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{
|
||||
errors.New("blah"),
|
||||
@ -1001,7 +1001,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, path.Join(membersPrefix, "0")),
|
||||
Method: "PUT",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{
|
||||
etcdserver.ErrPeerURLexists,
|
||||
@ -1015,7 +1015,7 @@ func TestServeMembersFail(t *testing.T) {
|
||||
URL: testutil.MustNewURL(t, path.Join(membersPrefix, "0")),
|
||||
Method: "PUT",
|
||||
Body: ioutil.NopCloser(strings.NewReader(`{"PeerURLs": ["http://127.0.0.1:1"]}`)),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
&errServer{
|
||||
etcdserver.ErrIDNotFound,
|
||||
@ -1918,12 +1918,12 @@ func TestTrimPrefix(t *testing.T) {
|
||||
|
||||
func TestNewMemberCollection(t *testing.T) {
|
||||
fixture := []*etcdserver.Member{
|
||||
&etcdserver.Member{
|
||||
{
|
||||
ID: 12,
|
||||
Attributes: etcdserver.Attributes{ClientURLs: []string{"http://localhost:8080", "http://localhost:8081"}},
|
||||
RaftAttributes: etcdserver.RaftAttributes{PeerURLs: []string{"http://localhost:8082", "http://localhost:8083"}},
|
||||
},
|
||||
&etcdserver.Member{
|
||||
{
|
||||
ID: 13,
|
||||
Attributes: etcdserver.Attributes{ClientURLs: []string{"http://localhost:9090", "http://localhost:9091"}},
|
||||
RaftAttributes: etcdserver.RaftAttributes{PeerURLs: []string{"http://localhost:9092", "http://localhost:9093"}},
|
||||
@ -1932,12 +1932,12 @@ func TestNewMemberCollection(t *testing.T) {
|
||||
got := newMemberCollection(fixture)
|
||||
|
||||
want := httptypes.MemberCollection([]httptypes.Member{
|
||||
httptypes.Member{
|
||||
{
|
||||
ID: "c",
|
||||
ClientURLs: []string{"http://localhost:8080", "http://localhost:8081"},
|
||||
PeerURLs: []string{"http://localhost:8082", "http://localhost:8083"},
|
||||
},
|
||||
httptypes.Member{
|
||||
{
|
||||
ID: "d",
|
||||
ClientURLs: []string{"http://localhost:9090", "http://localhost:9091"},
|
||||
PeerURLs: []string{"http://localhost:9092", "http://localhost:9093"},
|
||||
|
@ -28,7 +28,7 @@ func TestHTTPErrorWriteTo(t *testing.T) {
|
||||
|
||||
wcode := http.StatusBadRequest
|
||||
wheader := http.Header(map[string][]string{
|
||||
"Content-Type": []string{"application/json"},
|
||||
"Content-Type": {"application/json"},
|
||||
})
|
||||
wbody := `{"message":"what a bad request you made!"}`
|
||||
|
||||
|
@ -97,8 +97,8 @@ func TestMemberCreateRequestUnmarshal(t *testing.T) {
|
||||
body := []byte(`{"peerURLs": ["http://127.0.0.1:8081", "https://127.0.0.1:8080"]}`)
|
||||
want := MemberCreateRequest{
|
||||
PeerURLs: types.URLs([]url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:8081"},
|
||||
url.URL{Scheme: "https", Host: "127.0.0.1:8080"},
|
||||
{Scheme: "http", Host: "127.0.0.1:8081"},
|
||||
{Scheme: "https", Host: "127.0.0.1:8080"},
|
||||
}),
|
||||
}
|
||||
|
||||
|
@ -722,7 +722,7 @@ func (s *EtcdServer) publish(timeout time.Duration) {
|
||||
}
|
||||
|
||||
func (s *EtcdServer) send(ms []raftpb.Message) {
|
||||
for i, _ := range ms {
|
||||
for i := range ms {
|
||||
if s.cluster.IsIDRemoved(types.ID(ms[i].To)) {
|
||||
ms[i].To = 0
|
||||
}
|
||||
|
@ -509,10 +509,10 @@ func TestApplyConfChangeShouldStop(t *testing.T) {
|
||||
|
||||
func TestDoProposal(t *testing.T) {
|
||||
tests := []pb.Request{
|
||||
pb.Request{Method: "POST", ID: 1},
|
||||
pb.Request{Method: "PUT", ID: 1},
|
||||
pb.Request{Method: "DELETE", ID: 1},
|
||||
pb.Request{Method: "GET", ID: 1, Quorum: true},
|
||||
{Method: "POST", ID: 1},
|
||||
{Method: "PUT", ID: 1},
|
||||
{Method: "DELETE", ID: 1},
|
||||
{Method: "GET", ID: 1, Quorum: true},
|
||||
}
|
||||
for i, tt := range tests {
|
||||
st := &storeRecorder{}
|
||||
|
@ -417,7 +417,7 @@ func (c *cluster) Launch(t *testing.T) {
|
||||
errc <- m.Launch()
|
||||
}(m)
|
||||
}
|
||||
for _ = range c.Members {
|
||||
for range c.Members {
|
||||
if err := <-errc; err != nil {
|
||||
t.Fatalf("error setting up member: %v", err)
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ func (ci *CORSInfo) Set(s string) error {
|
||||
|
||||
func (ci *CORSInfo) String() string {
|
||||
o := make([]string, 0)
|
||||
for k, _ := range *ci {
|
||||
for k := range *ci {
|
||||
o = append(o, k)
|
||||
}
|
||||
return strings.Join(o, ",")
|
||||
|
@ -141,7 +141,7 @@ func TestURLsFromFlags(t *testing.T) {
|
||||
args: []string{},
|
||||
tlsInfo: transport.TLSInfo{},
|
||||
wantURLs: []url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:2379"},
|
||||
{Scheme: "http", Host: "127.0.0.1:2379"},
|
||||
},
|
||||
wantFail: false,
|
||||
},
|
||||
@ -151,8 +151,8 @@ func TestURLsFromFlags(t *testing.T) {
|
||||
args: []string{"-urls=https://192.0.3.17:2930,http://127.0.0.1:1024"},
|
||||
tlsInfo: transport.TLSInfo{},
|
||||
wantURLs: []url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:1024"},
|
||||
url.URL{Scheme: "https", Host: "192.0.3.17:2930"},
|
||||
{Scheme: "http", Host: "127.0.0.1:1024"},
|
||||
{Scheme: "https", Host: "192.0.3.17:2930"},
|
||||
},
|
||||
wantFail: false,
|
||||
},
|
||||
@ -162,7 +162,7 @@ func TestURLsFromFlags(t *testing.T) {
|
||||
args: []string{"-addr=192.0.2.3:1024"},
|
||||
tlsInfo: transport.TLSInfo{},
|
||||
wantURLs: []url.URL{
|
||||
url.URL{Scheme: "http", Host: "192.0.2.3:1024"},
|
||||
{Scheme: "http", Host: "192.0.2.3:1024"},
|
||||
},
|
||||
wantFail: false,
|
||||
},
|
||||
@ -175,7 +175,7 @@ func TestURLsFromFlags(t *testing.T) {
|
||||
KeyFile: "/tmp/bar",
|
||||
},
|
||||
wantURLs: []url.URL{
|
||||
url.URL{Scheme: "https", Host: "192.0.2.3:1024"},
|
||||
{Scheme: "https", Host: "192.0.2.3:1024"},
|
||||
},
|
||||
wantFail: false,
|
||||
},
|
||||
|
@ -33,45 +33,45 @@ func TestResolveTCPAddrs(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
urls: [][]url.URL{
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:4001"},
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:2379"},
|
||||
{
|
||||
{Scheme: "http", Host: "127.0.0.1:4001"},
|
||||
{Scheme: "http", Host: "127.0.0.1:2379"},
|
||||
},
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:7001"},
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:2380"},
|
||||
{
|
||||
{Scheme: "http", Host: "127.0.0.1:7001"},
|
||||
{Scheme: "http", Host: "127.0.0.1:2380"},
|
||||
},
|
||||
},
|
||||
expected: [][]url.URL{
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:4001"},
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:2379"},
|
||||
{
|
||||
{Scheme: "http", Host: "127.0.0.1:4001"},
|
||||
{Scheme: "http", Host: "127.0.0.1:2379"},
|
||||
},
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:7001"},
|
||||
url.URL{Scheme: "http", Host: "127.0.0.1:2380"},
|
||||
{
|
||||
{Scheme: "http", Host: "127.0.0.1:7001"},
|
||||
{Scheme: "http", Host: "127.0.0.1:2380"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
urls: [][]url.URL{
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:4001"},
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:2379"},
|
||||
{
|
||||
{Scheme: "http", Host: "infra0.example.com:4001"},
|
||||
{Scheme: "http", Host: "infra0.example.com:2379"},
|
||||
},
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:7001"},
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:2380"},
|
||||
{
|
||||
{Scheme: "http", Host: "infra0.example.com:7001"},
|
||||
{Scheme: "http", Host: "infra0.example.com:2380"},
|
||||
},
|
||||
},
|
||||
expected: [][]url.URL{
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "10.0.1.10:4001"},
|
||||
url.URL{Scheme: "http", Host: "10.0.1.10:2379"},
|
||||
{
|
||||
{Scheme: "http", Host: "10.0.1.10:4001"},
|
||||
{Scheme: "http", Host: "10.0.1.10:2379"},
|
||||
},
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "10.0.1.10:7001"},
|
||||
url.URL{Scheme: "http", Host: "10.0.1.10:2380"},
|
||||
{
|
||||
{Scheme: "http", Host: "10.0.1.10:7001"},
|
||||
{Scheme: "http", Host: "10.0.1.10:2380"},
|
||||
},
|
||||
},
|
||||
hostMap: map[string]string{
|
||||
@ -81,13 +81,13 @@ func TestResolveTCPAddrs(t *testing.T) {
|
||||
},
|
||||
{
|
||||
urls: [][]url.URL{
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:4001"},
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:2379"},
|
||||
{
|
||||
{Scheme: "http", Host: "infra0.example.com:4001"},
|
||||
{Scheme: "http", Host: "infra0.example.com:2379"},
|
||||
},
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:7001"},
|
||||
url.URL{Scheme: "http", Host: "infra0.example.com:2380"},
|
||||
{
|
||||
{Scheme: "http", Host: "infra0.example.com:7001"},
|
||||
{Scheme: "http", Host: "infra0.example.com:2380"},
|
||||
},
|
||||
},
|
||||
hostMap: map[string]string{
|
||||
@ -97,13 +97,13 @@ func TestResolveTCPAddrs(t *testing.T) {
|
||||
},
|
||||
{
|
||||
urls: [][]url.URL{
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "ssh://infra0.example.com:4001"},
|
||||
url.URL{Scheme: "http", Host: "ssh://infra0.example.com:2379"},
|
||||
{
|
||||
{Scheme: "http", Host: "ssh://infra0.example.com:4001"},
|
||||
{Scheme: "http", Host: "ssh://infra0.example.com:2379"},
|
||||
},
|
||||
[]url.URL{
|
||||
url.URL{Scheme: "http", Host: "ssh://infra0.example.com:7001"},
|
||||
url.URL{Scheme: "http", Host: "ssh://infra0.example.com:2380"},
|
||||
{
|
||||
{Scheme: "http", Host: "ssh://infra0.example.com:7001"},
|
||||
{Scheme: "http", Host: "ssh://infra0.example.com:2380"},
|
||||
},
|
||||
},
|
||||
hasError: true,
|
||||
|
@ -98,17 +98,17 @@ func TestNewTransportTLSInfo(t *testing.T) {
|
||||
defer os.Remove(tmp)
|
||||
|
||||
tests := []TLSInfo{
|
||||
TLSInfo{},
|
||||
TLSInfo{
|
||||
{},
|
||||
{
|
||||
CertFile: tmp,
|
||||
KeyFile: tmp,
|
||||
},
|
||||
TLSInfo{
|
||||
{
|
||||
CertFile: tmp,
|
||||
KeyFile: tmp,
|
||||
CAFile: tmp,
|
||||
},
|
||||
TLSInfo{
|
||||
{
|
||||
CAFile: tmp,
|
||||
},
|
||||
}
|
||||
@ -157,10 +157,10 @@ func TestTLSInfoMissingFields(t *testing.T) {
|
||||
defer os.Remove(tmp)
|
||||
|
||||
tests := []TLSInfo{
|
||||
TLSInfo{CertFile: tmp},
|
||||
TLSInfo{KeyFile: tmp},
|
||||
TLSInfo{CertFile: tmp, CAFile: tmp},
|
||||
TLSInfo{KeyFile: tmp, CAFile: tmp},
|
||||
{CertFile: tmp},
|
||||
{KeyFile: tmp},
|
||||
{CertFile: tmp, CAFile: tmp},
|
||||
{KeyFile: tmp, CAFile: tmp},
|
||||
}
|
||||
|
||||
for i, info := range tests {
|
||||
|
@ -91,7 +91,7 @@ func (us *unsafeSet) Length() int {
|
||||
// Values returns the values of the Set in an unspecified order.
|
||||
func (us *unsafeSet) Values() (values []string) {
|
||||
values = make([]string, 0)
|
||||
for val, _ := range us.d {
|
||||
for val := range us.d {
|
||||
values = append(values, val)
|
||||
}
|
||||
return
|
||||
@ -100,7 +100,7 @@ func (us *unsafeSet) Values() (values []string) {
|
||||
// Copy creates a new Set containing the values of the first
|
||||
func (us *unsafeSet) Copy() Set {
|
||||
cp := NewUnsafeSet()
|
||||
for val, _ := range us.d {
|
||||
for val := range us.d {
|
||||
cp.Add(val)
|
||||
}
|
||||
|
||||
|
@ -70,11 +70,11 @@ func TestNewDirectorScheme(t *testing.T) {
|
||||
func TestDirectorEndpointsFiltering(t *testing.T) {
|
||||
d := director{
|
||||
ep: []*endpoint{
|
||||
&endpoint{
|
||||
{
|
||||
URL: url.URL{Scheme: "http", Host: "192.0.2.5:5050"},
|
||||
Available: false,
|
||||
},
|
||||
&endpoint{
|
||||
{
|
||||
URL: url.URL{Scheme: "http", Host: "192.0.2.4:4000"},
|
||||
Available: true,
|
||||
},
|
||||
@ -83,7 +83,7 @@ func TestDirectorEndpointsFiltering(t *testing.T) {
|
||||
|
||||
got := d.endpoints()
|
||||
want := []*endpoint{
|
||||
&endpoint{
|
||||
{
|
||||
URL: url.URL{Scheme: "http", Host: "192.0.2.4:4000"},
|
||||
Available: true,
|
||||
},
|
||||
|
@ -56,19 +56,19 @@ func TestReverseProxyServe(t *testing.T) {
|
||||
|
||||
// error is returned from one endpoint that should be available
|
||||
{
|
||||
eps: []*endpoint{&endpoint{URL: u, Available: true}},
|
||||
eps: []*endpoint{{URL: u, Available: true}},
|
||||
rt: &staticRoundTripper{err: errors.New("what a bad trip")},
|
||||
want: http.StatusBadGateway,
|
||||
},
|
||||
|
||||
// endpoint is available and returns success
|
||||
{
|
||||
eps: []*endpoint{&endpoint{URL: u, Available: true}},
|
||||
eps: []*endpoint{{URL: u, Available: true}},
|
||||
rt: &staticRoundTripper{
|
||||
res: &http.Response{
|
||||
StatusCode: http.StatusCreated,
|
||||
Body: ioutil.NopCloser(&bytes.Reader{}),
|
||||
Header: map[string][]string{"Content-Type": []string{"application/json"}},
|
||||
Header: map[string][]string{"Content-Type": {"application/json"}},
|
||||
},
|
||||
},
|
||||
want: http.StatusCreated,
|
||||
@ -171,25 +171,25 @@ func TestMaybeSetForwardedFor(t *testing.T) {
|
||||
func TestRemoveSingleHopHeaders(t *testing.T) {
|
||||
hdr := http.Header(map[string][]string{
|
||||
// single-hop headers that should be removed
|
||||
"Connection": []string{"close"},
|
||||
"Keep-Alive": []string{"foo"},
|
||||
"Proxy-Authenticate": []string{"Basic realm=example.com"},
|
||||
"Proxy-Authorization": []string{"foo"},
|
||||
"Te": []string{"deflate,gzip"},
|
||||
"Trailers": []string{"ETag"},
|
||||
"Transfer-Encoding": []string{"chunked"},
|
||||
"Upgrade": []string{"WebSocket"},
|
||||
"Connection": {"close"},
|
||||
"Keep-Alive": {"foo"},
|
||||
"Proxy-Authenticate": {"Basic realm=example.com"},
|
||||
"Proxy-Authorization": {"foo"},
|
||||
"Te": {"deflate,gzip"},
|
||||
"Trailers": {"ETag"},
|
||||
"Transfer-Encoding": {"chunked"},
|
||||
"Upgrade": {"WebSocket"},
|
||||
|
||||
// headers that should persist
|
||||
"Accept": []string{"application/json"},
|
||||
"X-Foo": []string{"Bar"},
|
||||
"Accept": {"application/json"},
|
||||
"X-Foo": {"Bar"},
|
||||
})
|
||||
|
||||
removeSingleHopHeaders(&hdr)
|
||||
|
||||
want := http.Header(map[string][]string{
|
||||
"Accept": []string{"application/json"},
|
||||
"X-Foo": []string{"Bar"},
|
||||
"Accept": {"application/json"},
|
||||
"X-Foo": {"Bar"},
|
||||
})
|
||||
|
||||
if !reflect.DeepEqual(want, hdr) {
|
||||
@ -205,33 +205,33 @@ func TestCopyHeader(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
src: http.Header(map[string][]string{
|
||||
"Foo": []string{"bar", "baz"},
|
||||
"Foo": {"bar", "baz"},
|
||||
}),
|
||||
dst: http.Header(map[string][]string{}),
|
||||
want: http.Header(map[string][]string{
|
||||
"Foo": []string{"bar", "baz"},
|
||||
"Foo": {"bar", "baz"},
|
||||
}),
|
||||
},
|
||||
{
|
||||
src: http.Header(map[string][]string{
|
||||
"Foo": []string{"bar"},
|
||||
"Ping": []string{"pong"},
|
||||
"Foo": {"bar"},
|
||||
"Ping": {"pong"},
|
||||
}),
|
||||
dst: http.Header(map[string][]string{}),
|
||||
want: http.Header(map[string][]string{
|
||||
"Foo": []string{"bar"},
|
||||
"Ping": []string{"pong"},
|
||||
"Foo": {"bar"},
|
||||
"Ping": {"pong"},
|
||||
}),
|
||||
},
|
||||
{
|
||||
src: http.Header(map[string][]string{
|
||||
"Foo": []string{"bar", "baz"},
|
||||
"Foo": {"bar", "baz"},
|
||||
}),
|
||||
dst: http.Header(map[string][]string{
|
||||
"Foo": []string{"qux"},
|
||||
"Foo": {"qux"},
|
||||
}),
|
||||
want: http.Header(map[string][]string{
|
||||
"Foo": []string{"qux", "bar", "baz"},
|
||||
"Foo": {"qux", "bar", "baz"},
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ func TestDuelingCandidates(t *testing.T) {
|
||||
nt.send(pb.Message{From: 3, To: 3, Type: pb.MsgHup})
|
||||
|
||||
wlog := &raftLog{
|
||||
storage: &MemoryStorage{ents: []pb.Entry{{}, pb.Entry{Data: nil, Term: 1, Index: 1}}},
|
||||
storage: &MemoryStorage{ents: []pb.Entry{{}, {Data: nil, Term: 1, Index: 1}}},
|
||||
committed: 1,
|
||||
unstable: unstable{offset: 2},
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ var (
|
||||
|
||||
// the key is in string format "major.minor.patch"
|
||||
supportedStream = map[string][]streamType{
|
||||
"2.0.0": []streamType{streamTypeMsgApp},
|
||||
"2.1.0": []streamType{streamTypeMsgApp, streamTypeMsgAppV2, streamTypeMessage},
|
||||
"2.2.0": []streamType{streamTypeMsgApp, streamTypeMsgAppV2, streamTypeMessage},
|
||||
"2.0.0": {streamTypeMsgApp},
|
||||
"2.1.0": {streamTypeMsgApp, streamTypeMsgAppV2, streamTypeMessage},
|
||||
"2.2.0": {streamTypeMsgApp, streamTypeMsgAppV2, streamTypeMessage},
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -214,7 +214,7 @@ func (t *transport) RemovePeer(id types.ID) {
|
||||
func (t *transport) RemoveAllPeers() {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
for id, _ := range t.peers {
|
||||
for id := range t.peers {
|
||||
t.removePeer(id)
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ func TestContinuousCompact(t *testing.T) {
|
||||
{[]byte("foo2"), 6, nil, 4},
|
||||
}
|
||||
wa := map[revision]struct{}{
|
||||
revision{main: 1}: struct{}{},
|
||||
revision{main: 1}: {},
|
||||
}
|
||||
ga := index.Compact(1)
|
||||
if !reflect.DeepEqual(ga, wa) {
|
||||
@ -133,8 +133,8 @@ func TestContinuousCompact(t *testing.T) {
|
||||
verify(t, index, tests)
|
||||
|
||||
wa = map[revision]struct{}{
|
||||
revision{main: 1}: struct{}{},
|
||||
revision{main: 2}: struct{}{},
|
||||
revision{main: 1}: {},
|
||||
revision{main: 2}: {},
|
||||
}
|
||||
ga = index.Compact(2)
|
||||
if !reflect.DeepEqual(ga, wa) {
|
||||
@ -143,9 +143,9 @@ func TestContinuousCompact(t *testing.T) {
|
||||
verify(t, index, tests)
|
||||
|
||||
wa = map[revision]struct{}{
|
||||
revision{main: 1}: struct{}{},
|
||||
revision{main: 2}: struct{}{},
|
||||
revision{main: 3}: struct{}{},
|
||||
revision{main: 1}: {},
|
||||
revision{main: 2}: {},
|
||||
revision{main: 3}: {},
|
||||
}
|
||||
ga = index.Compact(3)
|
||||
if !reflect.DeepEqual(ga, wa) {
|
||||
@ -154,9 +154,9 @@ func TestContinuousCompact(t *testing.T) {
|
||||
verify(t, index, tests)
|
||||
|
||||
wa = map[revision]struct{}{
|
||||
revision{main: 1}: struct{}{},
|
||||
revision{main: 2}: struct{}{},
|
||||
revision{main: 4}: struct{}{},
|
||||
revision{main: 1}: {},
|
||||
revision{main: 2}: {},
|
||||
revision{main: 4}: {},
|
||||
}
|
||||
ga = index.Compact(4)
|
||||
delete(wa, revision{main: 3})
|
||||
@ -167,9 +167,9 @@ func TestContinuousCompact(t *testing.T) {
|
||||
verify(t, index, tests)
|
||||
|
||||
wa = map[revision]struct{}{
|
||||
revision{main: 2}: struct{}{},
|
||||
revision{main: 4}: struct{}{},
|
||||
revision{main: 5}: struct{}{},
|
||||
revision{main: 2}: {},
|
||||
revision{main: 4}: {},
|
||||
revision{main: 5}: {},
|
||||
}
|
||||
ga = index.Compact(5)
|
||||
delete(wa, revision{main: 1})
|
||||
@ -181,9 +181,9 @@ func TestContinuousCompact(t *testing.T) {
|
||||
verify(t, index, tests)
|
||||
|
||||
wa = map[revision]struct{}{
|
||||
revision{main: 4}: struct{}{},
|
||||
revision{main: 5}: struct{}{},
|
||||
revision{main: 6}: struct{}{},
|
||||
revision{main: 4}: {},
|
||||
revision{main: 5}: {},
|
||||
revision{main: 6}: {},
|
||||
}
|
||||
ga = index.Compact(6)
|
||||
delete(wa, revision{main: 2})
|
||||
|
@ -139,7 +139,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 2}: struct{}{},
|
||||
revision{main: 2}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -154,7 +154,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 2}: struct{}{},
|
||||
revision{main: 2}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -169,7 +169,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 4}: struct{}{},
|
||||
revision{main: 4}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -184,7 +184,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 4}: struct{}{},
|
||||
revision{main: 4}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -222,7 +222,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 8}: struct{}{},
|
||||
revision{main: 8}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -236,7 +236,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 8}: struct{}{},
|
||||
revision{main: 8}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -250,7 +250,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 10}: struct{}{},
|
||||
revision{main: 10}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -264,7 +264,7 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
},
|
||||
},
|
||||
map[revision]struct{}{
|
||||
revision{main: 10}: struct{}{},
|
||||
revision{main: 10}: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -13,11 +13,11 @@ import (
|
||||
func TestRevision(t *testing.T) {
|
||||
tests := []revision{
|
||||
// order in (main, sub)
|
||||
revision{},
|
||||
revision{main: 1, sub: 0},
|
||||
revision{main: 1, sub: 1},
|
||||
revision{main: 2, sub: 0},
|
||||
revision{main: math.MaxInt64, sub: math.MaxInt64},
|
||||
{},
|
||||
{main: 1, sub: 0},
|
||||
{main: 1, sub: 1},
|
||||
{main: 2, sub: 0},
|
||||
{main: math.MaxInt64, sub: math.MaxInt64},
|
||||
}
|
||||
|
||||
bs := make([][]byte, len(tests))
|
||||
|
Loading…
x
Reference in New Issue
Block a user