Skip to content

Commit a546a85

Browse files
authored
fix(coderd): set default provisionerjobs limit to 50 (#16450)
1 parent b3b229c commit a546a85

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

coderd/provisionerjobs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (api *API) handleAuthAndFetchProvisionerJobs(rw http.ResponseWriter, r *htt
101101

102102
qp := r.URL.Query()
103103
p := httpapi.NewQueryParamParser()
104-
limit := p.PositiveInt32(qp, 0, "limit")
104+
limit := p.PositiveInt32(qp, 50, "limit")
105105
status := p.Strings(qp, nil, "status")
106106
p.ErrorExcessParams(qp)
107107
if len(p.Errors) > 0 {

coderd/provisionerjobs_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ func TestProvisionerJobs(t *testing.T) {
6363
TemplateVersionID: version.ID,
6464
})
6565

66+
// Add more jobs than the default limit.
67+
for range 60 {
68+
dbgen.ProvisionerJob(t, db, nil, database.ProvisionerJob{
69+
OrganizationID: owner.OrganizationID,
70+
})
71+
}
72+
6673
t.Run("Single", func(t *testing.T) {
6774
t.Parallel()
6875
t.Run("OK", func(t *testing.T) {
@@ -82,12 +89,12 @@ func TestProvisionerJobs(t *testing.T) {
8289
})
8390
})
8491

85-
t.Run("All", func(t *testing.T) {
92+
t.Run("Default limit", func(t *testing.T) {
8693
t.Parallel()
8794
ctx := testutil.Context(t, testutil.WaitMedium)
8895
jobs, err := templateAdminClient.OrganizationProvisionerJobs(ctx, owner.OrganizationID, nil)
8996
require.NoError(t, err)
90-
require.Len(t, jobs, 3)
97+
require.Len(t, jobs, 50)
9198
})
9299

93100
t.Run("Status", func(t *testing.T) {

0 commit comments

Comments
 (0)