Skip to content

Commit

Permalink
command/agent/csi_endpoint: slice capacity, not size
Browse files Browse the repository at this point in the history
  • Loading branch information
langmartin committed Aug 11, 2020
1 parent f40fc32 commit 138b52a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion command/agent/csi_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ func structsTaskEventToApi(te *structs.TaskEvent) *api.TaskEvent {

// structsCSITopolgiesToApi converts topologies, part of structsCSIVolumeToApi
func structsCSITopolgiesToApi(tops []*structs.CSITopology) []*api.CSITopology {
out := make([]*api.CSITopology, len(tops))
out := make([]*api.CSITopology, 0, len(tops))
for _, t := range tops {
out = append(out, &api.CSITopology{
Segments: t.Segments,
Expand Down
1 change: 1 addition & 0 deletions command/agent/csi_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestHTTP_CSIEndpointUtils(t *testing.T) {
tops := structsCSITopolgiesToApi([]*structs.CSITopology{{
Segments: map[string]string{"foo": "bar"},
}})

require.Equal(t, "bar", tops[0].Segments["foo"])
}

Expand Down

0 comments on commit 138b52a

Please sign in to comment.