Skip to content

Commit

Permalink
csi: annotate remaining missing cancellation contexts (#7552)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross authored Mar 30, 2020
1 parent 860b83c commit 74e5c90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions client/allocrunner/csi_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ func (c *csiHook) Prerun() error {
return nil
}

// TODO(tgross): the contexts for the CSI RPC calls made during
// mounting can have very long timeouts. Until these are better
// tuned, there's not a good value to put here for a WithCancel
// without risking conflicts with the grpc retries/timeouts in the
// pluginmanager package.
ctx := context.TODO()

volumes, err := c.claimVolumesFromAlloc()
if err != nil {
return fmt.Errorf("claim volumes: %v", err)
Expand Down Expand Up @@ -71,7 +77,13 @@ func (c *csiHook) Postrun() error {
return nil
}

// TODO(tgross): the contexts for the CSI RPC calls made during
// mounting can have very long timeouts. Until these are better
// tuned, there's not a good value to put here for a WithCancel
// without risking conflicts with the grpc retries/timeouts in the
// pluginmanager package.
ctx := context.TODO()

volumes, err := c.csiVolumesFromAlloc()
if err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions client/pluginmanager/csimanager/fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestBuildBasicFingerprint_Node(t *testing.T) {
client.NextNodeGetInfoResponse = test.NodeInfo
client.NextNodeGetInfoErr = test.NodeInfoErr

info, err := im.fp.buildBasicFingerprint(context.TODO())
info, err := im.fp.buildBasicFingerprint(context.Background())

require.Equal(t, test.ExpectedCSIInfo, info)
require.Equal(t, test.ExpectedErr, err)
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestBuildControllerFingerprint(t *testing.T) {
client.NextPluginProbeResponse = test.ProbeResponse
client.NextPluginProbeErr = test.ProbeErr

info, err := im.fp.buildControllerFingerprint(context.TODO(), &structs.CSIInfo{ControllerInfo: &structs.CSIControllerInfo{}})
info, err := im.fp.buildControllerFingerprint(context.Background(), &structs.CSIInfo{ControllerInfo: &structs.CSIControllerInfo{}})

require.Equal(t, test.ExpectedControllerInfo, info.ControllerInfo)
require.Equal(t, test.ExpectedErr, err)
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestBuildNodeFingerprint(t *testing.T) {
client.NextNodeGetCapabilitiesResponse = test.Capabilities
client.NextNodeGetCapabilitiesErr = test.CapabilitiesErr

info, err := im.fp.buildNodeFingerprint(context.TODO(), &structs.CSIInfo{NodeInfo: &structs.CSINodeInfo{}})
info, err := im.fp.buildNodeFingerprint(context.Background(), &structs.CSIInfo{NodeInfo: &structs.CSINodeInfo{}})

require.Equal(t, test.ExpectedCSINodeInfo, info.NodeInfo)
require.Equal(t, test.ExpectedErr, err)
Expand Down

0 comments on commit 74e5c90

Please sign in to comment.