diff --git a/server/workflowarchive/archived_workflow_server.go b/server/workflowarchive/archived_workflow_server.go index a3c8500783b2..980352dd5cfa 100644 --- a/server/workflowarchive/archived_workflow_server.go +++ b/server/workflowarchive/archived_workflow_server.go @@ -40,8 +40,12 @@ func NewWorkflowArchiveServer(wfArchive sqldb.WorkflowArchive, offloadNodeStatus } func (w *archivedWorkflowServer) ListArchivedWorkflows(ctx context.Context, req *workflowarchivepkg.ListArchivedWorkflowsRequest) (*wfv1.WorkflowList, error) { + listOptions := metav1.ListOptions{} + if req.ListOptions != nil { + listOptions = *req.ListOptions + } - options, err := sutils.BuildListOptions(*req.ListOptions, req.Namespace, req.NamePrefix, "") + options, err := sutils.BuildListOptions(listOptions, req.Namespace, req.NamePrefix, "") if err != nil { return nil, err } diff --git a/test/e2e/argo_server_test.go b/test/e2e/argo_server_test.go index ff1a8e685649..abbd810a9580 100644 --- a/test/e2e/argo_server_test.go +++ b/test/e2e/argo_server_test.go @@ -1374,6 +1374,17 @@ spec: SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeArchived) + s.Run("ListWithoutListOptions", func() { + s.e().GET("/api/v1/archived-workflows"). + Expect(). + Status(200). + JSON(). + Path("$.items"). + Array(). + Length(). + IsEqual(3) + }) + for _, tt := range []struct { name string selector string