diff --git a/coderd/provisionerjobs.go b/coderd/provisionerjobs.go index 591c60855a65e..647274d9c29f7 100644 --- a/coderd/provisionerjobs.go +++ b/coderd/provisionerjobs.go @@ -101,7 +101,7 @@ func (api *API) handleAuthAndFetchProvisionerJobs(rw http.ResponseWriter, r *htt qp := r.URL.Query() p := httpapi.NewQueryParamParser() - limit := p.PositiveInt32(qp, 0, "limit") + limit := p.PositiveInt32(qp, 50, "limit") status := p.Strings(qp, nil, "status") p.ErrorExcessParams(qp) if len(p.Errors) > 0 { diff --git a/coderd/provisionerjobs_test.go b/coderd/provisionerjobs_test.go index a8fd4f2a968f2..098e118327c40 100644 --- a/coderd/provisionerjobs_test.go +++ b/coderd/provisionerjobs_test.go @@ -63,6 +63,13 @@ func TestProvisionerJobs(t *testing.T) { TemplateVersionID: version.ID, }) + // Add more jobs than the default limit. + for range 60 { + dbgen.ProvisionerJob(t, db, nil, database.ProvisionerJob{ + OrganizationID: owner.OrganizationID, + }) + } + t.Run("Single", func(t *testing.T) { t.Parallel() t.Run("OK", func(t *testing.T) { @@ -82,12 +89,12 @@ func TestProvisionerJobs(t *testing.T) { }) }) - t.Run("All", func(t *testing.T) { + t.Run("Default limit", func(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitMedium) jobs, err := templateAdminClient.OrganizationProvisionerJobs(ctx, owner.OrganizationID, nil) require.NoError(t, err) - require.Len(t, jobs, 3) + require.Len(t, jobs, 50) }) t.Run("Status", func(t *testing.T) {
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: