Skip to content

Commit

Permalink
Fix tests for releases
Browse files Browse the repository at this point in the history
Increased the pagination size to make implementation less chatty

This resolves the issue until we go over 40 releases

Signed-off-by: Marco Franssen <marco.franssen@philips.com>
  • Loading branch information
marcofranssen committed Jul 5, 2022
1 parent e5f2562 commit 68d75e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/github/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (p *ReleaseClient) FetchRelease(ctx context.Context, owner, repo, tagName s
listCtx, cancel := context.WithTimeout(ctx, 1*time.Minute)
defer cancel()

allReleases, err := p.ListReleases(listCtx, owner, repo, github.ListOptions{PerPage: 10})
allReleases, err := p.ListReleases(listCtx, owner, repo, github.ListOptions{PerPage: 20})
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/github/releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestFetchRelease(t *testing.T) {
assert.Equal(int64(51517953), release.GetID())
assert.Equal("v0.1.1", release.GetTagName())
assert.Len(release.Assets, 7)
assert.Equal(fmt.Sprintf("GET: %s?per_page=10\nGET: %s?page=2&per_page=10\n", api, api), requestLogger.String())
assert.Equal(fmt.Sprintf("GET: %s?per_page=20\nGET: %s?page=2&per_page=20\n", api, api), requestLogger.String())
}

func TestDownloadReleaseAssets(t *testing.T) {
Expand Down Expand Up @@ -195,7 +195,7 @@ func TestListReleases(t *testing.T) {
api := "https://api.github.com/repos/philips-labs/slsa-provenance-action/releases"

client, requestLogger := createReleaseClient(ctx)
opt := gh.ListOptions{PerPage: 10}
opt := gh.ListOptions{PerPage: 20}
releases, err := client.ListReleases(ctx, owner, repo, opt)
if !assert.NoError(err) {
return
Expand Down

0 comments on commit 68d75e4

Please sign in to comment.