Skip to content

Commit

Permalink
Merge pull request notaryproject#1034 from endophage/default_records
Browse files Browse the repository at this point in the history
fixing default records size for changefeed
  • Loading branch information
endophage authored Nov 15, 2016
2 parents 43aaf08 + 67935c4 commit ab9892b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [v0.5.1](https://github.com/docker/notary/releases/tag/v0.5.1) 11/14/2016
+ If no `records` parameter is provided in a request for the changefeed, a default value of 100 is used.

## [v0.5.0](https://github.com/docker/notary/releases/tag/v0.5.0) 11/14/2016
+ Non-certificate public keys in PEM format can now be added to delegation roles [#965](https://github.com/docker/notary/pull/965)
+ PostgreSQL support as a storage backend for Server and Signer [#920](https://github.com/docker/notary/pull/920)
Expand Down
2 changes: 1 addition & 1 deletion NOTARY_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.5.1
23 changes: 13 additions & 10 deletions server/handlers/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,19 @@ func checkChangefeedInputs(logger ctxu.Logger, s interface{}, r string) (
err = errors.ErrNoStorage.WithDetail(nil)
return
}
pageSize, err = strconv.ParseInt(r, 10, 32)
if err != nil {
logger.Errorf("400 GET invalid pageSize: %s", r)
err = errors.ErrInvalidParams.WithDetail(
fmt.Sprintf("invalid records parameter: %s", err.Error()),
)
return
}
if pageSize == 0 {
pageSize = notary.DefaultPageSize
pageSize = notary.DefaultPageSize
if r != "" {
pageSize, err = strconv.ParseInt(r, 10, 32)
if err != nil {
logger.Errorf("400 GET invalid records: %s", r)
err = errors.ErrInvalidParams.WithDetail(
fmt.Sprintf("invalid records parameter: %s", err.Error()),
)
return
}
if pageSize == 0 {
pageSize = notary.DefaultPageSize
}
}
return
}
10 changes: 10 additions & 0 deletions server/handlers/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ func Test_checkChangefeedInputs(t *testing.T) {
wantStore: s,
wantPageSize: -10,
},
{
name: "Empty string records",
args: args{
logger: logrus.New(),
s: s,
ps: "",
},
wantStore: s,
wantPageSize: 100,
},
}
for _, tt := range tests {
gotStore, gotPageSize, err := checkChangefeedInputs(tt.args.logger, tt.args.s, tt.args.ps)
Expand Down

0 comments on commit ab9892b

Please sign in to comment.