mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Fix unit test to fail with proper final gRPC code
Plain "errors.New" is interpreted as transient error.
This commit is contained in:
parent
8536787133
commit
afcbb68386
@ -88,6 +88,8 @@ go_test(
|
||||
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
|
||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||
"//vendor/google.golang.org/grpc/codes:go_default_library",
|
||||
"//vendor/google.golang.org/grpc/status:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -18,12 +18,14 @@ package csi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
"k8s.io/api/storage/v1beta1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -299,7 +301,7 @@ func TestBlockMapperSetupDeviceError(t *testing.T) {
|
||||
|
||||
csiMapper.csiClient = setupClient(t, true)
|
||||
fClient := csiMapper.csiClient.(*fakeCsiDriverClient)
|
||||
fClient.nodeClient.SetNextError(errors.New("mock final error"))
|
||||
fClient.nodeClient.SetNextError(status.Error(codes.InvalidArgument, "mock final error"))
|
||||
|
||||
attachID := getAttachmentName(csiMapper.volumeID, string(csiMapper.driverName), string(nodeName))
|
||||
attachment := makeTestAttachment(attachID, nodeName, pvName)
|
||||
|
Loading…
Reference in New Issue
Block a user