Skip to content

Commit

Permalink
fix: correct nil pointer when listing wf archive without list options.
Browse files Browse the repository at this point in the history
…Fixes argoproj#13804 (argoproj#13807)

Signed-off-by: Darko Janjic <[email protected]>
  • Loading branch information
djanjic authored Oct 25, 2024
1 parent ba7be67 commit 1017c1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/workflowarchive/archived_workflow_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/argo_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1017c1d

Please sign in to comment.