Skip to content

Commit

Permalink
Add first E2E test and changes to the framework required
Browse files Browse the repository at this point in the history
  • Loading branch information
davidz627 committed Jun 21, 2018
1 parent fb1c44b commit 8f0dcb2
Show file tree
Hide file tree
Showing 12 changed files with 381 additions and 52 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ all: gce-pd-driver
gce-pd-driver:
mkdir -p bin
go build -o bin/gce-pd-csi-driver ./cmd/
go build -o bin/gce-pd-csi-driver-test ./test/e2e/

build-container: gce-pd-driver
docker build -t $(STAGINGIMAGE):$(STAGINGVERSION) .
Expand Down
8 changes: 4 additions & 4 deletions pkg/gce-cloud-provider/fake-gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ func FakeCreateCloudProvider(project, zone string) (*FakeCloudProvider, error) {
}

// Getters
func (cloud *FakeCloudProvider) GetProject() (string, error) {
return cloud.project, nil
func (cloud *FakeCloudProvider) GetProject() string {
return cloud.project
}
func (cloud *FakeCloudProvider) GetZone() (string, error) {
return cloud.zone, nil
func (cloud *FakeCloudProvider) GetZone() string {
return cloud.zone
}

// Disk Methods
Expand Down
12 changes: 6 additions & 6 deletions pkg/gce-cloud-provider/gce-compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

type GCECompute interface {
// Getters
GetProject() (string, error)
GetZone() (string, error)
GetProject() string
GetZone() string
// Disk Methods
GetDiskOrError(ctx context.Context, volumeZone, volumeName string) (*compute.Disk, error)
GetAndValidateExistingDisk(ctx context.Context, configuredZone, name, diskType string, reqBytes, limBytes int64) (exists bool, err error)
Expand All @@ -47,12 +47,12 @@ type GCECompute interface {
WaitForOp(ctx context.Context, op *compute.Operation, zone string) error
}

func (cloud *CloudProvider) GetProject() (string, error) {
return cloud.project, nil
func (cloud *CloudProvider) GetProject() string {
return cloud.project
}

func (cloud *CloudProvider) GetZone() (string, error) {
return cloud.zone, nil
func (cloud *CloudProvider) GetZone() string {
return cloud.zone
}

func (cloud *CloudProvider) GetDiskOrError(ctx context.Context, volumeZone, volumeName string) (*compute.Disk, error) {
Expand Down
5 changes: 1 addition & 4 deletions pkg/gce-csi-driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
// Apply Parameters (case-insensitive). We leave validation of
// the values to the cloud provider.
diskType := "pd-standard"
configuredZone, err := gceCS.CloudProvider.GetZone()
if err != nil {
return nil, status.Error(codes.Internal, "CreateVolume failed to get zone")
}
configuredZone := gceCS.CloudProvider.GetZone()
for k, v := range req.GetParameters() {
if k == "csiProvisionerSecretName" || k == "csiProvisionerSecretNamespace" {
// These are hardcoded secrets keys required to function but not needed by GCE PD
Expand Down
5 changes: 4 additions & 1 deletion pkg/mount-manager/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import (
)

const (
diskByIdPath = "/host/dev/disk/by-id/"
diskByHostIdPath = "/host/dev/disk/by-id/"
diskByIdPath = "/dev/disk/by-id/"
diskGooglePrefix = "google-"
diskScsiGooglePrefix = "scsi-0Google_PersistentDisk_"
diskPartitionSuffix = "-part"
Expand Down Expand Up @@ -193,6 +194,8 @@ func (m *GCEMounter) GetDiskByIdPaths(pdName string, partition string) []string
devicePaths := []string{
path.Join(diskByIdPath, diskGooglePrefix+pdName),
path.Join(diskByIdPath, diskScsiGooglePrefix+pdName),
path.Join(diskByHostIdPath, diskScsiGooglePrefix+pdName),
path.Join(diskByHostIdPath, diskScsiGooglePrefix+pdName),
}

if partition != "" {
Expand Down
5 changes: 3 additions & 2 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
How to run Dev tests:
go run test/remote/run_remote/run_remote.go --logtostderr --v 2 --project test-project --zone us-central1-c --ssh-env gce --delete-instances=false --cleanup=false --results-dir=my_test
# How to run Dev tests:

go run test/remote/run_remote/run_remote.go --logtostderr --v 2 --project dyzz-test --zone us-central1-c --ssh-env gce --delete-instances=false --cleanup=false --results-dir=my_test --service-account=${IAM_NAME}
27 changes: 0 additions & 27 deletions test/e2e/e2e.go

This file was deleted.

Loading

0 comments on commit 8f0dcb2

Please sign in to comment.