Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion driver/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/kubernetes-csi/csi-test/v5/utils"
)
Expand Down Expand Up @@ -91,7 +92,7 @@ func (m *MockCSIDriver) Nexus() (*grpc.ClientConn, error) {
}

// Create a client connection
m.conn, err = utils.Connect(m.Address(), grpc.WithInsecure())
m.conn, err = utils.Connect(m.Address(), grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, err
}
Expand Down
13 changes: 6 additions & 7 deletions pkg/sanity/sanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"crypto/rand"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
Expand All @@ -30,6 +29,7 @@ import (
yaml "gopkg.in/yaml.v2"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -72,7 +72,7 @@ type TestConfig struct {
Address string

// DialOptions specifies the options that are to be used
// when connecting to Address. The default is grpc.WithInsecure().
// when connecting to Address. The default is grpc.WithTransportCredentials(insecure.NewCredentials()).
// A dialer will be added for Unix Domain Sockets.
DialOptions []grpc.DialOption

Expand Down Expand Up @@ -204,8 +204,8 @@ func NewTestConfig() TestConfig {
IdempotentCount: 10,
CheckPathCmdTimeout: 10 * time.Second,

DialOptions: []grpc.DialOption{grpc.WithInsecure(), grpc.WithAuthority("localhost")},
ControllerDialOptions: []grpc.DialOption{grpc.WithInsecure(), grpc.WithAuthority("localhost")},
DialOptions: []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithAuthority("localhost")},
ControllerDialOptions: []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithAuthority("localhost")},
}
}

Expand Down Expand Up @@ -340,7 +340,6 @@ func (sc *TestContext) Finalize() {
// target path using a custom command, custom function or falls back to the
// default using mkdir and returns the new target path.
func createMountTargetLocation(targetPath string, createPathCmd string, customCreateDir func(string) (string, error), timeout time.Duration) (string, error) {

// Return the target path if empty.
if targetPath == "" {
return targetPath, nil
Expand Down Expand Up @@ -413,7 +412,7 @@ func removeMountTargetLocation(targetPath string, removePathCmd string, customRe
func loadSecrets(path string) (*CSISecrets, error) {
var creds CSISecrets

yamlFile, err := ioutil.ReadFile(path)
yamlFile, err := os.ReadFile(path)
if err != nil {
return &creds, fmt.Errorf("failed to read file %q: #%v", path, err)
}
Expand All @@ -429,7 +428,7 @@ func loadSecrets(path string) (*CSISecrets, error) {
// loadFromFile reads struct from given file path.
func loadFromFile(from string, to interface{}) {
if len(from) != 0 {
yamlFile, err := ioutil.ReadFile(from)
yamlFile, err := os.ReadFile(from)
if err != nil {
panic(fmt.Sprintf("failed to read file %q: %v", from, err))
}
Expand Down
7 changes: 4 additions & 3 deletions test/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/kubernetes-csi/csi-test/v5/utils"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/reflection"
)

Expand All @@ -47,7 +48,8 @@ func (s *simpleDriver) Probe(context.Context, *csi.ProbeRequest) (*csi.ProbeResp
}

func (s *simpleDriver) GetPluginInfo(
context.Context, *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
context.Context, *csi.GetPluginInfoRequest,
) (*csi.GetPluginInfoResponse, error) {
return &csi.GetPluginInfoResponse{
Name: "simpleDriver",
VendorVersion: "0.1.1",
Expand Down Expand Up @@ -95,7 +97,6 @@ func (s *simpleDriver) Stop() {

// Tests
func TestSimpleDriver(t *testing.T) {

// Setup simple driver
s := &simpleDriver{}
err := s.Start()
Expand All @@ -105,7 +106,7 @@ func TestSimpleDriver(t *testing.T) {
defer s.Stop()

// Setup a connection to the driver
conn, err := utils.Connect(s.Address(), grpc.WithInsecure())
conn, err := utils.Connect(s.Address(), grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
t.Errorf("Error: %s", err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion utils/grpcutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func Connect(address string, dialOptions ...grpc.DialOption) (*grpc.ClientConn,
}))
}

conn, err := grpc.Dial(address, dialOptions...)
conn, err := grpc.NewClient(address, dialOptions...)
if err != nil {
return nil, err
}
Expand Down