Skip to content

Commit 3fd13c7

Browse files
committed
Merge pull request oracle#87 in OKE/oci-cloud-controller-manager from OKE-11885 to internal
* commit 'de479f26c13840ed8fe53a1798bcfebee8e2a321': JIRA: OKE-11885 - Fix CSI E2E test for static csi provisioning.
2 parents c27f008 + de479f2 commit 3fd13c7

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

manifests/container-storage-interface/oci-csi-node-driver.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ spec:
8181
type: Directory
8282
- name: device-dir
8383
hostPath:
84-
path: /dev
84+
path: /dev

test/e2e/cloud-provider-oci/csi_volume_creation.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ var _ = Describe("CSI Volume Creation", func() {
5757

5858
pvcJig.CheckVolumeCapacity("100Gi", pvc.Name, f.Namespace.Name)
5959
})
60+
})
61+
})
6062

63+
var _ = Describe("CSI Static Volume Creation", func() {
64+
f := framework.NewBackupFramework("csi-static")
65+
Context("[cloudprovider][storage][csi]", func() {
6166
It("Static Provisioning CSI", func() {
6267
pvcJig := framework.NewPVCTestJig(f.ClientSet, "csi-provisioner-e2e-tests-pvc-with-static")
6368

@@ -73,7 +78,7 @@ var _ = Describe("CSI Volume Creation", func() {
7378
} else {
7479
framework.Failf("Compartment Id undefined.")
7580
}
76-
pvc := pvcJig.CreateAndAwaitStaticPVCOrFailCSI(f.Namespace.Name, framework.MinVolumeBlock, scName, setupF.AdLocation, compartmentId, nil)
81+
pvc := pvcJig.CreateAndAwaitStaticPVCOrFailCSI(f.BlockStorageClient, f.Namespace.Name, framework.MinVolumeBlock, scName, setupF.AdLocation, compartmentId, nil)
7782

7883
pvcJig.NewPODForCSI("app4", f.Namespace.Name, pvc.Name, setupF.AdLabel)
7984

test/e2e/framework/pvc_util.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package framework
1616

1717
import (
1818
"fmt"
19-
"github.com/oracle/oci-go-sdk/common"
2019
"go.uber.org/zap"
2120
"golang.org/x/net/context"
2221
"time"
@@ -235,9 +234,9 @@ func (j *PVCTestJig) CreateAndAwaitPVCOrFailCSI(namespace string, volumeSize str
235234
// jig's defaults, waits for it to become ready, and then sanity checks it and
236235
// its dependant resources. Callers can provide a function to tweak the
237236
// PVC object before it is created.
238-
func (j *PVCTestJig) CreateAndAwaitStaticPVCOrFailCSI(namespace string, volumeSize string, scName string, adLabel string, compartmentId string, tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim {
237+
func (j *PVCTestJig) CreateAndAwaitStaticPVCOrFailCSI(bs ocicore.BlockstorageClient, namespace string, volumeSize string, scName string, adLabel string, compartmentId string, tweak func(pvc *v1.PersistentVolumeClaim)) *v1.PersistentVolumeClaim {
239238

240-
volumeOcid := j.CreateVolume(adLabel, compartmentId, "test-volume")
239+
volumeOcid := j.CreateVolume(bs, adLabel, compartmentId, "test-volume")
241240

242241
pv := j.CreatePVorFailCSI(namespace, scName, *volumeOcid)
243242
pv = j.waitForConditionOrFailForPV(pv.Name, DefaultTimeout, "to be dynamically provisioned", func(pvc *v1.PersistentVolume) bool {
@@ -263,9 +262,8 @@ func (j *PVCTestJig) CreateAndAwaitStaticPVCOrFailCSI(namespace string, volumeSi
263262
}
264263

265264
// CreateVolume is a function to create the block volume
266-
func (j *PVCTestJig) CreateVolume(adLabel string, compartmentId string, volName string) *string {
265+
func (j *PVCTestJig) CreateVolume(bs ocicore.BlockstorageClient, adLabel string, compartmentId string, volName string) *string {
267266
var size int64 =50
268-
//var compartmentId = "ocid1.compartment.oc1..aaaaaaaai6jt6asobfmkm5geioeod3zh6nxzjiplu722opjuoxxrndxjos6q"
269267
request := ocicore.CreateVolumeRequest{
270268
CreateVolumeDetails: ocicore.CreateVolumeDetails {
271269
AvailabilityDomain: &adLabel,
@@ -275,10 +273,6 @@ func (j *PVCTestJig) CreateVolume(adLabel string, compartmentId string, volName
275273
},
276274
}
277275

278-
bs, err := ocicore.NewBlockstorageClientWithConfigurationProvider(common.DefaultConfigProvider())
279-
if err != nil {
280-
Failf("Failed to create Block Storage Client: %v", err)
281-
}
282276
newVolume, err := bs.CreateVolume(context.Background(), request)
283277
if err != nil {
284278
Failf("Volume %q creation API error: %v", volName, err)

0 commit comments

Comments
 (0)