Skip to content

Commit 5b931fb

Browse files
authored
Merge pull request kubernetes-sigs#9 from davidz627/feature/E2EtestNEW
Add first E2E test and changes to the framework required
2 parents fb1c44b + 8f0dcb2 commit 5b931fb

File tree

12 files changed

+381
-52
lines changed

12 files changed

+381
-52
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ all: gce-pd-driver
2222
gce-pd-driver:
2323
mkdir -p bin
2424
go build -o bin/gce-pd-csi-driver ./cmd/
25-
go build -o bin/gce-pd-csi-driver-test ./test/e2e/
2625

2726
build-container: gce-pd-driver
2827
docker build -t $(STAGINGIMAGE):$(STAGINGVERSION) .

pkg/gce-cloud-provider/fake-gce.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ func FakeCreateCloudProvider(project, zone string) (*FakeCloudProvider, error) {
4545
}
4646

4747
// Getters
48-
func (cloud *FakeCloudProvider) GetProject() (string, error) {
49-
return cloud.project, nil
48+
func (cloud *FakeCloudProvider) GetProject() string {
49+
return cloud.project
5050
}
51-
func (cloud *FakeCloudProvider) GetZone() (string, error) {
52-
return cloud.zone, nil
51+
func (cloud *FakeCloudProvider) GetZone() string {
52+
return cloud.zone
5353
}
5454

5555
// Disk Methods

pkg/gce-cloud-provider/gce-compute.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import (
3030

3131
type GCECompute interface {
3232
// Getters
33-
GetProject() (string, error)
34-
GetZone() (string, error)
33+
GetProject() string
34+
GetZone() string
3535
// Disk Methods
3636
GetDiskOrError(ctx context.Context, volumeZone, volumeName string) (*compute.Disk, error)
3737
GetAndValidateExistingDisk(ctx context.Context, configuredZone, name, diskType string, reqBytes, limBytes int64) (exists bool, err error)
@@ -47,12 +47,12 @@ type GCECompute interface {
4747
WaitForOp(ctx context.Context, op *compute.Operation, zone string) error
4848
}
4949

50-
func (cloud *CloudProvider) GetProject() (string, error) {
51-
return cloud.project, nil
50+
func (cloud *CloudProvider) GetProject() string {
51+
return cloud.project
5252
}
5353

54-
func (cloud *CloudProvider) GetZone() (string, error) {
55-
return cloud.zone, nil
54+
func (cloud *CloudProvider) GetZone() string {
55+
return cloud.zone
5656
}
5757

5858
func (cloud *CloudProvider) GetDiskOrError(ctx context.Context, volumeZone, volumeName string) (*compute.Disk, error) {

pkg/gce-csi-driver/controller.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
9494
// Apply Parameters (case-insensitive). We leave validation of
9595
// the values to the cloud provider.
9696
diskType := "pd-standard"
97-
configuredZone, err := gceCS.CloudProvider.GetZone()
98-
if err != nil {
99-
return nil, status.Error(codes.Internal, "CreateVolume failed to get zone")
100-
}
97+
configuredZone := gceCS.CloudProvider.GetZone()
10198
for k, v := range req.GetParameters() {
10299
if k == "csiProvisionerSecretName" || k == "csiProvisionerSecretNamespace" {
103100
// These are hardcoded secrets keys required to function but not needed by GCE PD

pkg/mount-manager/mounter.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import (
3030
)
3131

3232
const (
33-
diskByIdPath = "/host/dev/disk/by-id/"
33+
diskByHostIdPath = "/host/dev/disk/by-id/"
34+
diskByIdPath = "/dev/disk/by-id/"
3435
diskGooglePrefix = "google-"
3536
diskScsiGooglePrefix = "scsi-0Google_PersistentDisk_"
3637
diskPartitionSuffix = "-part"
@@ -193,6 +194,8 @@ func (m *GCEMounter) GetDiskByIdPaths(pdName string, partition string) []string
193194
devicePaths := []string{
194195
path.Join(diskByIdPath, diskGooglePrefix+pdName),
195196
path.Join(diskByIdPath, diskScsiGooglePrefix+pdName),
197+
path.Join(diskByHostIdPath, diskScsiGooglePrefix+pdName),
198+
path.Join(diskByHostIdPath, diskScsiGooglePrefix+pdName),
196199
}
197200

198201
if partition != "" {

test/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
How to run Dev tests:
2-
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
1+
# How to run Dev tests:
2+
3+
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}

test/e2e/e2e.go

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)