fix(coderd): set default provisionerjobs limit to 50 (#16450)

This commit is contained in:
Mathias Fredriksson
2025-02-05 15:04:35 +00:00
committed by GitHub
parent b3b229c73d
commit a546a85975
2 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -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 {
+9 -2
View File
@@ -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) {