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
@ -14,7 +14,6 @@ limitations under the License.
|
||||
package util
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
@ -35,7 +34,7 @@ func TestGetPassphraseFromKMS(t *testing.T) {
|
||||
|
||||
volEnc, err := NewVolumeEncryption(provider.UniqueID, kms)
|
||||
if errors.Is(err, ErrDEKStoreNeeded) {
|
||||
_, err = volEnc.KMS.GetSecret(context.TODO(), "")
|
||||
_, err = volEnc.KMS.GetSecret(t.Context(), "")
|
||||
if errors.Is(err, kmsapi.ErrGetSecretUnsupported) {
|
||||
continue // currently unsupported by fscrypt integration
|
||||
}
|
||||
@ -46,7 +45,7 @@ func TestGetPassphraseFromKMS(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
|
||||
secret, err := kms.GetSecret(context.TODO(), "")
|
||||
secret, err := kms.GetSecret(t.Context(), "")
|
||||
require.NoError(t, err, provider.UniqueID)
|
||||
require.NotEmpty(t, secret, provider.UniqueID)
|
||||
}
|
||||
|
Reference in New Issue
Block a user