Skip to content

Commit

Permalink
Skip instead of fail when VSC is absent (#5196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan Memisoglu committed Mar 13, 2019
1 parent d990456 commit 2137acb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/kube/snapshot/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
snapshotfake "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/fake"
. "gopkg.in/check.v1"
corev1 "k8s.io/api/core/v1"
k8errors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -61,7 +62,10 @@ func (s *SnapshotTestSuite) SetUpSuite(c *C) {
s.snapCli = sc

vscs, err := sc.VolumesnapshotV1alpha1().VolumeSnapshotClasses().List(metav1.ListOptions{})
c.Assert(err, IsNil)
if !k8errors.IsNotFound(err) {
c.Logf("Failed to query VolumeSnapshotClass, skipping test. Error: %v", err)
c.Fail()
}
if len(vscs.Items) != 0 {
s.snapshotClass = &vscs.Items[0].Name
}
Expand Down

0 comments on commit 2137acb

Please sign in to comment.