Skip to content

Commit

Permalink
Merge pull request #2017 from Jakub007d/master
Browse files Browse the repository at this point in the history
[CCXDEV-12623] display_name added to objects/workloads list
  • Loading branch information
Jakub007d authored Jun 26, 2024
2 parents fd8ad28 + 5a552e9 commit e8f0b2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions server/dvo_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ type DVORecommendation struct {

// DVOObject structure
type DVOObject struct {
Kind string `json:"kind"`
UID string `json:"uid"`
Kind string `json:"kind"`
UID string `json:"uid"`
DisplayName string `json:"display_name"`
}

// readNamespace retrieves namespace UUID from request
Expand Down Expand Up @@ -228,8 +229,9 @@ func (server *HTTPServer) ProcessSingleDVONamespace(workload types.DVOReport) (
continue
}
filteredObjects = append(filteredObjects, DVOObject{
Kind: object.Kind,
UID: object.UID,
Kind: object.Kind,
UID: object.UID,
DisplayName: object.Name,
})
}

Expand Down
10 changes: 6 additions & 4 deletions server/dvo_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,14 @@ func TestProcessSingleDVONamespace_MustFilterZeroObjects_CCXDEV_12589_Reproducer
assert.Equal(t, 2, len(processedWorkload.Recommendations[0].Objects))
expectedObjects := []server.DVOObject{
{
UID: "193a2099-0000-1111-916a-d570c9aac158",
Kind: "Pod",
UID: "193a2099-0000-1111-916a-d570c9aac158",
Kind: "Pod",
DisplayName: "test-name-0001",
},
{
UID: "193a2099-1234-5678-916a-d570c9aac158",
Kind: "DaemonSet",
UID: "193a2099-1234-5678-916a-d570c9aac158",
Kind: "DaemonSet",
DisplayName: "test-name-0099",
},
}
assert.ElementsMatch(t, expectedObjects, processedWorkload.Recommendations[0].Objects)
Expand Down

0 comments on commit e8f0b2b

Please sign in to comment.