mirror of
https://github.com/tendermint/tendermint.git
synced 2026-04-29 03:46:57 +00:00
address pr comments
This commit is contained in:
@@ -352,7 +352,11 @@ func TestSwitchStopPeerForError(t *testing.T) {
|
||||
defer s.Close()
|
||||
|
||||
scrapeMetrics := func() string {
|
||||
resp, _ := http.Get(s.URL)
|
||||
resp, err := http.Get(s.URL)
|
||||
if err != nil {
|
||||
t.Errorf("error on GET request: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
buf, _ := ioutil.ReadAll(resp.Body)
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
@@ -70,13 +70,6 @@ func Validators(ctx *rpctypes.Context, heightPtr *int64, page, perPage int) (*ct
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// page & perPage === 0 then all validators are returned, no pagination
|
||||
if page == 0 && perPage == 0 {
|
||||
return &ctypes.ResultValidators{
|
||||
BlockHeight: height,
|
||||
Validators: validators.Validators,
|
||||
}, nil
|
||||
}
|
||||
|
||||
totalCount := len(validators.Validators)
|
||||
perPage = validatePerPage(perPage)
|
||||
@@ -84,23 +77,14 @@ func Validators(ctx *rpctypes.Context, heightPtr *int64, page, perPage int) (*ct
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
skipCount := validateSkipCount(page, perPage)
|
||||
apiResults := make([]*types.Validator, cmn.MinInt(perPage, totalCount-skipCount))
|
||||
|
||||
for i := 0; i < len(apiResults); i++ {
|
||||
v := validators.Validators[skipCount+i]
|
||||
|
||||
apiResults[i] = &types.Validator{
|
||||
Address: v.Address,
|
||||
PubKey: v.PubKey,
|
||||
VotingPower: v.VotingPower,
|
||||
ProposerPriority: v.ProposerPriority,
|
||||
}
|
||||
}
|
||||
v := validators.Validators[skipCount : skipCount+cmn.MinInt(perPage, totalCount-skipCount)]
|
||||
|
||||
return &ctypes.ResultValidators{
|
||||
BlockHeight: height,
|
||||
Validators: apiResults}, nil
|
||||
Validators: v}, nil
|
||||
}
|
||||
|
||||
// DumpConsensusState dumps consensus state.
|
||||
|
||||
@@ -253,6 +253,7 @@ func (c *WSClient) dial() error {
|
||||
}
|
||||
rHeader := http.Header{}
|
||||
conn, _, err := dialer.Dial(c.protocol+"://"+c.Address+c.Endpoint, rHeader)
|
||||
defer conn.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ func TestRPCParams(t *testing.T) {
|
||||
rec := httptest.NewRecorder()
|
||||
mux.ServeHTTP(rec, req)
|
||||
res := rec.Result()
|
||||
defer res.Body.Close()
|
||||
// Always expecting back a JSONRPCResponse
|
||||
assert.True(t, statusOK(res.StatusCode), "#%d: should always return 2XX", i)
|
||||
blob, err := ioutil.ReadAll(res.Body)
|
||||
|
||||
Reference in New Issue
Block a user