Skip to content

Commit ed8c03c

Browse files
authored
Merge pull request #143 from msau42/gke-testing
Make boskos resource name configurable
2 parents 98cba09 + a70899a commit ed8c03c

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

test/e2e/tests/setup_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var _ = BeforeSuite(func() {
6262
Expect(err).To(BeNil())
6363

6464
if *runInProw {
65-
*project, *serviceAccount = testutils.SetupProwConfig()
65+
*project, *serviceAccount = testutils.SetupProwConfig("gce-project")
6666
}
6767

6868
Expect(*project).ToNot(BeEmpty(), "Project should not be empty")

test/e2e/utils/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ func GCEClientAndDriverSetup(instance *remote.InstanceInfo) (*remote.TestContext
6464
return remote.SetupNewDriverAndClient(instance, config)
6565
}
6666

67-
func SetupProwConfig() (project, serviceAccount string) {
67+
func SetupProwConfig(resourceType string) (project, serviceAccount string) {
6868
// Try to get a Boskos project
6969
glog.V(4).Infof("Running in PROW")
7070
glog.V(4).Infof("Fetching a Boskos loaned project")
7171

72-
p, err := boskos.Acquire("gce-project", "free", "busy")
72+
p, err := boskos.Acquire(resourceType, "free", "busy")
7373
if err != nil {
7474
glog.Fatalf("boskos failed to acquire project: %v", err)
7575
}
7676

7777
if p == nil {
78-
glog.Fatal("boskos does not have a free gce-project at the moment")
78+
glog.Fatal("boskos does not have a free %s at the moment", resourceType)
7979
}
8080

8181
project = p.GetName()

test/k8s-integration/main.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ import (
3232
)
3333

3434
var (
35-
teardownCluster = flag.Bool("teardown-cluster", true, "teardown the cluster after the e2e test")
36-
teardownDriver = flag.Bool("teardown-driver", true, "teardown the driver after the e2e test")
37-
bringupCluster = flag.Bool("bringup-cluster", true, "build kubernetes and bringup a cluster")
38-
stagingImage = flag.String("staging-image", "", "name of image to stage to")
39-
kubeVersion = flag.String("kube-version", "master", "version of Kubernetes to download and use")
40-
inProw = flag.Bool("run-in-prow", false, "is the test running in PROW")
41-
saFile = flag.String("service-account-file", "", "path of service account file")
42-
deployOverlayName = flag.String("deploy-overlay-name", "", "which kustomize overlay to deploy the driver with")
43-
localK8sDir = flag.String("local-k8s-dir", "", "local kubernetes/kubernetes directory to run e2e tests from")
44-
doDriverBuild = flag.Bool("do-driver-build", true, "building the driver from source")
35+
teardownCluster = flag.Bool("teardown-cluster", true, "teardown the cluster after the e2e test")
36+
teardownDriver = flag.Bool("teardown-driver", true, "teardown the driver after the e2e test")
37+
bringupCluster = flag.Bool("bringup-cluster", true, "build kubernetes and bringup a cluster")
38+
stagingImage = flag.String("staging-image", "", "name of image to stage to")
39+
kubeVersion = flag.String("kube-version", "master", "version of Kubernetes to download and use")
40+
inProw = flag.Bool("run-in-prow", false, "is the test running in PROW")
41+
saFile = flag.String("service-account-file", "", "path of service account file")
42+
deployOverlayName = flag.String("deploy-overlay-name", "", "which kustomize overlay to deploy the driver with")
43+
localK8sDir = flag.String("local-k8s-dir", "", "local kubernetes/kubernetes directory to run e2e tests from")
44+
doDriverBuild = flag.Bool("do-driver-build", true, "building the driver from source")
45+
boskosResourceType = flag.String("boskos-resource-type", "gce-project", "name of the boskos resource type to reserve")
4546
)
4647

4748
func init() {
@@ -83,7 +84,7 @@ func handle() error {
8384
k8sDir := filepath.Join(k8sIoDir, "kubernetes")
8485

8586
if *inProw {
86-
project, _ := testutils.SetupProwConfig()
87+
project, _ := testutils.SetupProwConfig(*boskosResourceType)
8788

8889
oldProject, err := exec.Command("gcloud", "config", "get-value", "project").CombinedOutput()
8990
if err != nil {

test/run-k8s-integration.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
# GCE_PD_OVERLAY_NAME: which Kustomize overlay to deploy with
55
# GCE_PD_DO_DRIVER_BUILD: if set, don't build the driver from source and just
66
# use the driver version from the overlay
7+
# GCE_PD_BOSKOS_RESOURCE_TYPE: name of the boskos resource type to reserve
78

89
set -o nounset
910
set -o errexit
1011

1112
readonly PKGDIR=${GOPATH}/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
1213
readonly overlay_name="${GCE_PD_OVERLAY_NAME:-prow-head-template}"
14+
readonly boskos_resource_type="${GCE_PD_BOSKOS_RESOURCE_TYPE:-gce-project}"
1315
readonly do_driver_build="${GCE_PD_DO_DRIVER_BUILD:-true}"
1416

1517
make -C ${PKGDIR} test-k8s-integration
16-
${PKGDIR}/bin/k8s-integration-test --kube-version=master --run-in-prow=true --deploy-overlay-name=${overlay_name} --service-account-file=${E2E_GOOGLE_APPLICATION_CREDENTIALS} --do-driver-build=${do_driver_build}
18+
${PKGDIR}/bin/k8s-integration-test --kube-version=master --run-in-prow=true --deploy-overlay-name=${overlay_name} --service-account-file=${E2E_GOOGLE_APPLICATION_CREDENTIALS} --do-driver-build=${do_driver_build} --boskos-resource-type=${boskos_resource_type}

0 commit comments

Comments
 (0)