aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwashcycle <litho23@gmail.com>2023-04-26 21:37:27 -0500
committerwashcycle <litho23@gmail.com>2023-04-26 21:37:27 -0500
commitceb40f2444d9b409b187a72ca8e8abeb437af62e (patch)
treea18517ebeeb16cecbf3d0d9b3397352691ae15d1
parentb9cdc91ecb6008a33438d6a6407d5d4ddad9e361 (diff)
downloadseaweedfs-csi-driver-ceb40f2444d9b409b187a72ca8e8abeb437af62e.tar.xz
seaweedfs-csi-driver-ceb40f2444d9b409b187a72ca8e8abeb437af62e.zip
Implement CSI Test Suite
Fixes #115
-rw-r--r--go.mod33
-rw-r--r--pkg/driver/controllerserver.go5
-rw-r--r--pkg/driver/driver.go7
-rw-r--r--pkg/driver/utils.go15
-rwxr-xr-xtest/test.sh13
5 files changed, 44 insertions, 29 deletions
diff --git a/go.mod b/go.mod
index 3859b30..6f481be 100644
--- a/go.mod
+++ b/go.mod
@@ -10,44 +10,48 @@ require (
require github.com/seaweedfs/seaweedfs v0.0.0-20230417045743-8ecdf958ab05
-require github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd // indirect
-
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
+ github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
- github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
+ github.com/go-openapi/jsonpointer v0.19.6 // indirect
+ github.com/go-openapi/jsonreference v0.20.1 // indirect
+ github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
+ github.com/google/gnostic v0.5.7-v3refs // indirect
+ github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
+ github.com/google/pprof v0.0.0-20230111200839-76d1ae5aea2b // indirect
+ github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
+ github.com/kr/pretty v0.3.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
+ github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
- github.com/pelletier/go-toml v1.9.5 // indirect
- github.com/pelletier/go-toml/v2 v2.0.7 // indirect
+ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
- github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
- github.com/seaweedfs/goexif v2.0.0+incompatible // indirect
- github.com/spf13/afero v1.9.5 // indirect
+ github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/viant/ptrie v0.3.0 // indirect
- github.com/viant/toolbox v0.34.5 // indirect
- golang.org/x/crypto v0.7.0 // indirect
+ go.uber.org/atomic v1.10.0 // indirect
golang.org/x/image v0.6.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.7.0 // indirect
@@ -56,18 +60,15 @@ require (
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 // indirect
- google.golang.org/grpc/security/advancedtls v0.0.0-20230321232853-a02aae6168aa // indirect
google.golang.org/protobuf v1.30.0 // indirect
- gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
- k8s.io/apimachinery v0.26.3 // indirect
- k8s.io/client-go v0.26.3
- k8s.io/klog v1.0.0
+ k8s.io/api v0.27.1 // indirect
+ k8s.io/apimachinery v0.27.1 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
- k8s.io/utils v0.0.0-20230313181309-38a27ef9d749
+ k8s.io/kube-openapi v0.0.0-20230308215209-15aac26d736a // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
diff --git a/pkg/driver/controllerserver.go b/pkg/driver/controllerserver.go
index b032542..b90a09c 100644
--- a/pkg/driver/controllerserver.go
+++ b/pkg/driver/controllerserver.go
@@ -95,11 +95,6 @@ func (cs *ControllerServer) ControllerPublishVolume(ctx context.Context, req *cs
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
}
- volumePath := req.GetVolumeContext()["volumePath"]
- if len(volumePath) == 0 {
- return nil, status.Error(codes.InvalidArgument, "Volume path missing in request")
- }
-
nodeId := req.NodeId
if len(nodeId) == 0 {
return nil, status.Error(codes.InvalidArgument, "Node ID missing in request")
diff --git a/pkg/driver/driver.go b/pkg/driver/driver.go
index 5a375e1..f26d59b 100644
--- a/pkg/driver/driver.go
+++ b/pkg/driver/driver.go
@@ -91,9 +91,12 @@ func (n *SeaweedFsDriver) initClient() error {
func (n *SeaweedFsDriver) Run() {
s := NewNonBlockingGRPCServer()
+
+ c, _ := NewControllerServer(n)
+
s.Start(n.endpoint,
NewIdentityServer(n),
- NewControllerServer(n),
+ c,
NewNodeServer(n))
s.Wait()
}
@@ -171,5 +174,5 @@ func (d *SeaweedFsDriver) AdjustedUrl(location *filer_pb.Location) string {
return location.Url
}
func (d *SeaweedFsDriver) GetDataCenter() string {
- return ""
+ return d.DataCenter
}
diff --git a/pkg/driver/utils.go b/pkg/driver/utils.go
index e103079..8343ae7 100644
--- a/pkg/driver/utils.go
+++ b/pkg/driver/utils.go
@@ -12,6 +12,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog"
"golang.org/x/net/context"
"google.golang.org/grpc"
+ "k8s.io/client-go/rest"
"k8s.io/utils/mount"
)
@@ -32,10 +33,18 @@ func NewIdentityServer(d *SeaweedFsDriver) *IdentityServer {
}
}
-func NewControllerServer(d *SeaweedFsDriver) *ControllerServer {
+func NewControllerServer(d *SeaweedFsDriver) (*ControllerServer, error) {
+
+ // Get the Kubernetes configuration
+ c, err := rest.InClusterConfig()
+ if err != nil {
+ fmt.Errorf("failed to get Kubernetes config: %v", err)
+ }
+
return &ControllerServer{
Driver: d,
- }
+ config: c,
+ }, nil
}
func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability {
@@ -124,7 +133,7 @@ func (km *KeyMutex) RemoveMutex(key string) {
}
func CheckDataLocality(dataLocality *datalocality.DataLocality, dataCenter *string) error {
- if(*dataLocality != datalocality.None && *dataCenter == ""){
+ if *dataLocality != datalocality.None && *dataCenter == "" {
return fmt.Errorf("dataLocality set, but not all locality-definitions were set")
}
return nil
diff --git a/test/test.sh b/test/test.sh
index 5d6eb12..a96d4ce 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -7,16 +7,23 @@ cd csi-test
make install
## Start Local weed server with filer
-weed server -dir=/tmp/seaweedfs/data -s3 -volume.max=100 -volume.port=8090
+weed server -dir=/tmp/seaweedfs/data -s3 -volume.max=100 -volume.port=8090 -master.volumeSizeLimitMB=256
## Run CSI Driver
cd ../seaweedfs-csi-driver
make build
-./_output/seaweedfs-csi-driver -endpoint="$endpoint" -alsologtostderr -v=5 -filer=localhost:8888 -nodeid=test
+./_output/seaweedfs-csi-driver -endpoint="$endpoint" -alsologtostderr -v=5 -filer=localhost:8888 -nodeid=test
# Run CSI Sanity Tests
../csi-test/cmd/csi-sanity/csi-sanity\
--ginkgo.v\
--csi.testvolumeparameters="$(pwd)/test/sanity/params.yaml"\
+ --csi.endpoint="$endpoint"\
+ --ginkgo.skip="should not fail when requesting to create a volume with already existing name and same capacity|should fail when requesting to create a volume with already existing name and different capacity|should work|should fail when the requested volume does not exist|should return appropriate capabilities"
+
+../csi-test/cmd/csi-sanity/csi-test\
+ --ginkgo.v\
+ --csi.testvolumeparameters="$(pwd)/test/sanity/params.yaml"\
--csi.endpoint="$endpoint"\
- --ginkgo.skip="should not fail when requesting to create a volume with already existing name and same capacity|should fail when requesting to create a volume with already existing name and different capacity|should work|should fail when the requested volume does not exist|should return appropriate capabilities" \ No newline at end of file
+ --ginkgo.label-filter=""
+ \ No newline at end of file