Skip to content

Commit 9b0a06c

Browse files
committed
fix: fix the testing bug due to update vendor
Signed-off-by: ZeroMagic <[email protected]>
1 parent 36af7fd commit 9b0a06c

File tree

33 files changed

+1917
-1885
lines changed

33 files changed

+1917
-1885
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/Azure/go-autorest/autorest/adal v0.8.2
99
github.com/container-storage-interface/spec v1.2.0
1010
github.com/golang/protobuf v1.3.2
11-
github.com/kubernetes-csi/external-snapshotter v1.2.2
1211
github.com/onsi/ginkgo v1.11.0
1312
github.com/onsi/gomega v1.7.0
1413
github.com/pborman/uuid v1.2.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,6 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
367367
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
368368
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
369369
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
370-
github.com/kubernetes-csi/external-snapshotter v1.2.2 h1:OPXoJydNqkWjhLwJ20dSqOhkmUYcpm+CCO0pYm+C8Q8=
371-
github.com/kubernetes-csi/external-snapshotter v1.2.2/go.mod h1:oYfxnsuh48V1UDYORl77YQxQbbdokNy7D73phuFpksY=
372370
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
373371
github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc=
374372
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=

pkg/blobfuse/azure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ users:
8383
{
8484
desc: "[failure] out of cluster & in cluster, specify a empty kubeconfig, no credential file",
8585
kubeconfig: emptyKubeConfig,
86-
expectedErr: fmt.Errorf("failed to get KubeClient: invalid configuration: no configuration has been provided"),
86+
expectedErr: fmt.Errorf("failed to get KubeClient: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable"),
8787
},
8888
{
8989
desc: "[failure] out of cluster & in cluster, specify a fake kubeconfig, no credential file",

test/e2e/driver/blobfuse_csi_driver.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121

2222
"sigs.k8s.io/blobfuse-csi-driver/pkg/blobfuse"
2323

24-
"github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
2524
v1 "k8s.io/api/core/v1"
2625
storagev1 "k8s.io/api/storage/v1"
2726
"k8s.io/apimachinery/pkg/api/resource"
@@ -46,12 +45,6 @@ func (d *blobFuseCSIDriver) GetDynamicProvisionStorageClass(parameters map[strin
4645
return getStorageClass(generateName, provisioner, parameters, mountOptions, reclaimPolicy, bindingMode, nil)
4746
}
4847

49-
func (d *blobFuseCSIDriver) GetVolumeSnapshotClass(namespace string) *v1alpha1.VolumeSnapshotClass {
50-
provisioner := d.driverName
51-
generateName := fmt.Sprintf("%s-%s-dynamic-sc-", namespace, provisioner)
52-
return getVolumeSnapshotClass(generateName, provisioner)
53-
}
54-
5548
func (d *blobFuseCSIDriver) GetPersistentVolume(volumeID string, fsType string, size string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, namespace string, attrib map[string]string, nodeStageSecretRef string) *v1.PersistentVolume {
5649
provisioner := d.driverName
5750
generateName := fmt.Sprintf("%s-%s-preprovsioned-pv-", namespace, provisioner)

test/e2e/driver/driver.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,14 @@ limitations under the License.
1717
package driver
1818

1919
import (
20-
"github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
2120
v1 "k8s.io/api/core/v1"
2221
storagev1 "k8s.io/api/storage/v1"
2322
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2423
)
2524

26-
const (
27-
VolumeSnapshotClassKind = "VolumeSnapshotClass"
28-
SnapshotAPIVersion = "snapshot.storage.k8s.io/v1alpha1"
29-
)
30-
3125
type PVTestDriver interface {
3226
DynamicPVTestDriver
3327
PreProvisionedVolumeTestDriver
34-
VolumeSnapshotTestDriver
3528
}
3629

3730
// DynamicPVTestDriver represents an interface for a CSI driver that supports DynamicPV
@@ -48,10 +41,6 @@ type PreProvisionedVolumeTestDriver interface {
4841
GetPreProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass
4942
}
5043

51-
type VolumeSnapshotTestDriver interface {
52-
GetVolumeSnapshotClass(namespace string) *v1alpha1.VolumeSnapshotClass
53-
}
54-
5544
func getStorageClass(
5645
generateName string,
5746
provisioner string,
@@ -81,17 +70,3 @@ func getStorageClass(
8170
AllowedTopologies: allowedTopologies,
8271
}
8372
}
84-
85-
func getVolumeSnapshotClass(generateName string, provisioner string) *v1alpha1.VolumeSnapshotClass {
86-
return &v1alpha1.VolumeSnapshotClass{
87-
TypeMeta: metav1.TypeMeta{
88-
Kind: VolumeSnapshotClassKind,
89-
APIVersion: SnapshotAPIVersion,
90-
},
91-
92-
ObjectMeta: metav1.ObjectMeta{
93-
GenerateName: generateName,
94-
},
95-
Snapshotter: provisioner,
96-
}
97-
}

test/e2e/suite_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package e2e
1818

1919
import (
2020
"context"
21+
"flag"
2122
"fmt"
2223
"log"
2324
"os"
@@ -32,6 +33,7 @@ import (
3233
"github.com/onsi/gomega"
3334
"github.com/pborman/uuid"
3435
"k8s.io/kubernetes/test/e2e/framework"
36+
"k8s.io/kubernetes/test/e2e/framework/config"
3537
"sigs.k8s.io/blobfuse-csi-driver/pkg/blobfuse"
3638
"sigs.k8s.io/blobfuse-csi-driver/test/utils/azure"
3739
"sigs.k8s.io/blobfuse-csi-driver/test/utils/credentials"
@@ -60,7 +62,7 @@ var _ = ginkgo.BeforeSuite(func() {
6062
kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
6163
os.Setenv(kubeconfigEnvVar, kubeconfig)
6264
}
63-
framework.HandleFlags()
65+
handleFlags()
6466
framework.AfterReadingAllFlags(&framework.TestContext)
6567

6668
if testutil.IsRunningInProw() {
@@ -170,3 +172,11 @@ func execTestCmd(cmds []testCmd) {
170172
log.Println(cmd.endLog)
171173
}
172174
}
175+
176+
// handleFlags sets up all flags and parses the command line.
177+
func handleFlags() {
178+
config.CopyFlags(config.Flags, flag.CommandLine)
179+
framework.RegisterCommonFlags(flag.CommandLine)
180+
framework.RegisterClusterFlags(flag.CommandLine)
181+
flag.Parse()
182+
}

test/e2e/testsuites/specs.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
v1 "k8s.io/api/core/v1"
2626
storagev1 "k8s.io/api/storage/v1"
2727
clientset "k8s.io/client-go/kubernetes"
28-
restclientset "k8s.io/client-go/rest"
2928
)
3029

3130
type PodDetails struct {
@@ -61,13 +60,10 @@ const (
6160
)
6261

6362
const (
64-
VolumeSnapshotKind = "VolumeSnapshot"
65-
SnapshotAPIVersion = "snapshot.storage.k8s.io/v1alpha1"
6663
APIVersionv1alpha1 = "v1alpha1"
6764
)
6865

6966
var (
70-
SnapshotAPIGroup = "snapshot.storage.k8s.io"
7167
supportedStorageAccountTypes = []string{"Standard_LRS", "Premium_LRS", "Standard_GRS", "Standard_RAGRS"}
7268
)
7369

@@ -167,9 +163,7 @@ func (volume *VolumeDetails) SetupDynamicPersistentVolumeClaim(client clientset.
167163
var tpvc *TestPersistentVolumeClaim
168164
if volume.DataSource != nil {
169165
dataSource := &v1.TypedLocalObjectReference{
170-
Name: volume.DataSource.Name,
171-
Kind: VolumeSnapshotKind,
172-
APIGroup: &SnapshotAPIGroup,
166+
Name: volume.DataSource.Name,
173167
}
174168
tpvc = NewTestPersistentVolumeClaimWithDataSource(client, namespace, volume.ClaimSize, volume.VolumeMode, &createdStorageClass, dataSource)
175169
} else {
@@ -207,12 +201,3 @@ func (volume *VolumeDetails) SetupPreProvisionedPersistentVolumeClaim(client cli
207201

208202
return tpvc, cleanupFuncs
209203
}
210-
211-
func CreateVolumeSnapshotClass(client restclientset.Interface, namespace *v1.Namespace, csiDriver driver.VolumeSnapshotTestDriver) (*TestVolumeSnapshotClass, func()) {
212-
ginkgo.By("setting up the VolumeSnapshotClass")
213-
volumeSnapshotClass := csiDriver.GetVolumeSnapshotClass(namespace.Name)
214-
tvsc := NewTestVolumeSnapshotClass(client, namespace, volumeSnapshotClass)
215-
tvsc.Create()
216-
217-
return tvsc, tvsc.Cleanup
218-
}

0 commit comments

Comments
 (0)