Skip to content

Commit

Permalink
*: fix code style issue
Browse files Browse the repository at this point in the history
1. it's easy to check wrong input if using drain_exec_sync_io_timeout in error
2. avoid to use full error message, as part of error generated by go
   stdlib would be changed in the future
3. delete the extra empty line

Signed-off-by: Wei Fu <[email protected]>
(cherry picked from commit 5946c10)
Signed-off-by: Wei Fu <[email protected]>
  • Loading branch information
fuweid committed Feb 16, 2024
1 parent 2a38c7e commit aac4887
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/cri/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
// Validation for drain_exec_sync_io_timeout
if c.DrainExecSyncIOTimeout != "" {
if _, err := time.ParseDuration(c.DrainExecSyncIOTimeout); err != nil {
return warnings, fmt.Errorf("invalid drain exec sync io timeout: %w", err)
return warnings, fmt.Errorf("invalid `drain_exec_sync_io_timeout`: %w", err)
}
}
return warnings, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ func TestValidateConfig(t *testing.T) {
},
DrainExecSyncIOTimeout: "10",
},
expectedErr: "invalid drain exec sync io timeout: time: missing unit in duration \"10\"",
expectedErr: "invalid `drain_exec_sync_io_timeout`",
},
} {
t.Run(desc, func(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion pkg/cri/server/container_execsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ func drainExecSyncIO(ctx context.Context, execProcess containerd.Process, drainE

select {
case <-timerCh:

case <-attachDone:
log.G(ctx).Debugf("Stream pipe for exec process %q done", execProcess.ID())
return nil
Expand Down

0 comments on commit aac4887

Please sign in to comment.