Skip to content

Commit b85c3a2

Browse files
authored
Merge pull request #114 from davidz627/feature/k8sIntegrationTest
Adding Kubernetes Integration Test Framework
2 parents a05409a + 1e4864c commit b85c3a2

File tree

10 files changed

+397
-5
lines changed

10 files changed

+397
-5
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Possible Kubernetes source location
2+
test/k8s-integration

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Compiled binaries and deployment files
22
bin/
3+
test/k8s-integration/src/
34

45
# Personal testing
56
/my_test/

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# GCE_PD_CSI_STAGING_IMAGE: Staging image repository
1717

1818
STAGINGIMAGE=${GCE_PD_CSI_STAGING_IMAGE}
19-
STAGINGVERSION=latest
19+
STAGINGVERSION=${GCE_PD_CSI_STAGING_VERSION}
2020

2121
PRODIMAGE=gcr.io/google-containers/volume-csi/gcp-compute-persistent-disk-csi-driver
2222
PRODVERSION=v0.1.0.alpha
@@ -25,11 +25,17 @@ all: gce-pd-driver
2525

2626
gce-pd-driver:
2727
mkdir -p bin
28+
ifndef GCE_PD_CSI_STAGING_VERSION
29+
$(error "Must set environment variable GCE_PD_CSI_STAGING_VERSION to staging version")
30+
endif
2831
go build -ldflags "-X main.vendorVersion=${STAGINGVERSION}" -o bin/gce-pd-csi-driver ./cmd/
2932

3033
build-container:
3134
ifndef GCE_PD_CSI_STAGING_IMAGE
3235
$(error "Must set environment variable GCE_PD_CSI_STAGING_IMAGE to staging image repository")
36+
endif
37+
ifndef GCE_PD_CSI_STAGING_VERSION
38+
$(error "Must set environment variable GCE_PD_CSI_STAGING_VERSION to staging version")
3339
endif
3440
docker build --build-arg TAG=$(STAGINGVERSION) -t $(STAGINGIMAGE):$(STAGINGVERSION) .
3541

@@ -44,3 +50,6 @@ prod-push-container: prod-build-container
4450

4551
test-sanity: gce-pd-driver
4652
go test -timeout 30s sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/test -run ^TestSanity$
53+
54+
test-k8s-integration:
55+
go build -o bin/k8s-integration-test ./test/k8s-integration

pkg/gce-pd-csi-driver/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ var _ csi.ControllerServer = &GCEControllerServer{}
4646
const (
4747
// MaxVolumeSizeInBytes is the maximum standard and ssd size of 64TB
4848
MaxVolumeSizeInBytes int64 = 64 * 1024 * 1024 * 1024 * 1024
49-
MinimumVolumeSizeInBytes int64 = 5 * 1024 * 1024 * 1024
50-
MinimumDiskSizeInGb = 5
49+
MinimumVolumeSizeInBytes int64 = 1 * 1024 * 1024 * 1024
50+
MinimumDiskSizeInGb = 1
5151

5252
DiskTypeSSD = "pd-ssd"
5353
DiskTypeStandard = "pd-standard"

test/e2e/utils/utils.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ func GCEClientAndDriverSetup(instance *remote.InstanceInfo) (*remote.TestContext
5656
Port: port,
5757
}
5858

59+
err := os.Setenv("GCE_PD_CSI_STAGING_VERSION", "latest")
60+
if err != nil {
61+
return nil, err
62+
}
63+
5964
return remote.SetupNewDriverAndClient(instance, config)
6065
}
6166

@@ -104,7 +109,7 @@ func SetupProwConfig() (project, serviceAccount string) {
104109
// Default Compute Engine service account
105110
// [PROJECT_NUMBER][email protected]
106111
serviceAccount = fmt.Sprintf("%[email protected]", resp.ProjectNumber)
107-
glog.V(4).Infof("Using project %v", project)
112+
glog.Infof("Using project %v and service account %v", project, serviceAccount)
108113
return project, serviceAccount
109114
}
110115

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
KUBE_GIT_COMMIT='somefakecommit'
2+
KUBE_GIT_TREE_STATE='dirty'
3+
KUBE_GIT_VERSION='v888.888.888-fake-testing-master.version'
4+
KUBE_GIT_MAJOR='888'
5+
KUBE_GIT_MINOR='888+'

0 commit comments

Comments
 (0)