mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
cleanup: address golangci 'usetesting' linter issues
When a context.Context is needed in a unit test, t.Context() should be used instead of creating a new one with context.TODO() or context.Background(). Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
be5462cf62
commit
457ffe884a
@ -41,7 +41,7 @@ func TestExecCommandWithTimeout(t *testing.T) {
|
||||
{
|
||||
name: "echo hello",
|
||||
args: args{
|
||||
ctx: context.TODO(),
|
||||
ctx: t.Context(),
|
||||
program: "echo",
|
||||
timeout: time.Second,
|
||||
args: []string{"hello"},
|
||||
@ -53,7 +53,7 @@ func TestExecCommandWithTimeout(t *testing.T) {
|
||||
{
|
||||
name: "sleep with timeout",
|
||||
args: args{
|
||||
ctx: context.TODO(),
|
||||
ctx: t.Context(),
|
||||
program: "sleep",
|
||||
timeout: time.Second,
|
||||
args: []string{"3"},
|
||||
|
Reference in New Issue
Block a user