Skip to content

Commit

Permalink
Merge pull request #449 from hime/main
Browse files Browse the repository at this point in the history
Support InvalidArgument Failed Mount description from GCSFuse in e2e Tests
  • Loading branch information
hime authored Jan 29, 2025
2 parents c316dfc + 70ae93f commit e5d8871
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/e2e/testsuites/failed_mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/onsi/ginkgo/v2"
"google.golang.org/grpc/codes"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/klog/v2"
"k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
Expand Down Expand Up @@ -169,8 +170,24 @@ func (t *gcsFuseCSIFailedMountTestSuite) DefineTests(driver storageframework.Tes
defer tPod.Cleanup(ctx)

ginkgo.By("Checking that the pod has failed mount error")
tPod.WaitForFailedMountError(ctx, codes.NotFound.String())
tPod.WaitForFailedMountError(ctx, "storage: bucket doesn't exist")

if gcsfuseVersionStr == "" {
gcsfuseVersionStr = specs.GetGCSFuseVersion(ctx, f.ClientSet)
}

gcsfuseSupportsInvalidResp := true
v, err := version.ParseSemantic(gcsfuseVersionStr)
if err == nil && v != nil {
gcsfuseSupportsInvalidResp = v.AtLeast(version.MustParseSemantic("v2.9.0"))
}

if configPrefix == specs.SkipCSIBucketAccessCheckAndInvalidVolumePrefix && gcsfuseSupportsInvalidResp {
tPod.WaitForFailedMountError(ctx, codes.InvalidArgument.String())
tPod.WaitForFailedMountError(ctx, "name should be a valid bucket resource name")
} else {
tPod.WaitForFailedMountError(ctx, codes.NotFound.String())
tPod.WaitForFailedMountError(ctx, "storage: bucket doesn't exist")
}
}

ginkgo.It("should fail when the specified GCS bucket name is invalid", func() {
Expand Down

0 comments on commit e5d8871

Please sign in to comment.