diff --git a/command/agent/csi_endpoint.go b/command/agent/csi_endpoint.go index d29e2e0e068f..1ef62750c4d9 100644 --- a/command/agent/csi_endpoint.go +++ b/command/agent/csi_endpoint.go @@ -316,9 +316,8 @@ func structsCSIPluginToApi(plug *structs.CSIPlugin) *api.CSIPlugin { func structsJobDescriptionToApi(desc structs.JobDescription) api.JobDescription { return api.JobDescription{ Namespace: desc.Namespace, - JobID: desc.JobID, + ID: desc.ID, Version: desc.Version, - Expected: desc.Expected, } } @@ -378,6 +377,7 @@ func structsCSIInfoToApi(info *structs.CSIInfo) *api.CSIInfo { } out := &api.CSIInfo{ PluginID: info.PluginID, + AllocID: info.AllocID, Healthy: info.Healthy, HealthDescription: info.HealthDescription, UpdateTime: info.UpdateTime, diff --git a/command/agent/csi_endpoint_test.go b/command/agent/csi_endpoint_test.go index 5dc8ed5f6b80..3415c9c52e30 100644 --- a/command/agent/csi_endpoint_test.go +++ b/command/agent/csi_endpoint_test.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/nomad/nomad/mock" "github.com/hashicorp/nomad/nomad/state" "github.com/hashicorp/nomad/nomad/structs" - "github.com/kr/pretty" "github.com/stretchr/testify/require" ) @@ -33,11 +32,13 @@ func TestHTTP_CSIEndpointPlugin(t *testing.T) { out, ok := obj.(*api.CSIPlugin) require.True(t, ok) - require.Equal(t, 1, out.ControllersExpected) + // ControllersExpected is 0 because this plugin was created without a job, + // which sets expected + require.Equal(t, 0, out.ControllersExpected) require.Equal(t, 1, out.ControllersHealthy) require.Len(t, out.Controllers, 1) - require.Equal(t, 2, out.NodesExpected) + require.Equal(t, 0, out.NodesExpected) require.Equal(t, 2, out.NodesHealthy) require.Len(t, out.Nodes, 2) }) @@ -92,11 +93,7 @@ func TestHTTP_CSIEndpointVolume(t *testing.T) { out, ok := raw.(*api.CSIVolume) require.True(t, ok) - pretty.Log(out) - - require.Equal(t, 1, out.ControllersExpected) require.Equal(t, 1, out.ControllersHealthy) - require.Equal(t, 2, out.NodesExpected) require.Equal(t, 2, out.NodesHealthy) }) }