Skip to content

Commit

Permalink
GRPC e2e tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hime committed Dec 10, 2024
1 parent e478187 commit add2858
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 7 deletions.
22 changes: 20 additions & 2 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ var _ = ginkgo.Describe("E2E Test Suite", func() {
testsuites.InitGcsFuseCSIMetadataPrefetchTestSuite,
}

testDriver := specs.InitGCSFuseCSITestDriver(c, m, *bucketLocation, *skipGcpSaTest, false)
testDriver := specs.InitGCSFuseCSITestDriver(c, m, *bucketLocation, *skipGcpSaTest, false, false)

ginkgo.Context(fmt.Sprintf("[Driver: %s]", testDriver.GetDriverInfo().Name), func() {
storageframework.DefineTestSuites(testDriver, GCSFuseCSITestSuites)
Expand All @@ -126,9 +126,27 @@ var _ = ginkgo.Describe("E2E Test Suite", func() {
testsuites.InitGcsFuseCSIGCSFuseIntegrationFileCacheParallelDownloadsTestSuite,
}

testDriverHNS := specs.InitGCSFuseCSITestDriver(c, m, *bucketLocation, *skipGcpSaTest, true)
testDriverHNS := specs.InitGCSFuseCSITestDriver(c, m, *bucketLocation, *skipGcpSaTest, true, false)

ginkgo.Context(fmt.Sprintf("[Driver: %s HNS]", testDriverHNS.GetDriverInfo().Name), func() {
storageframework.DefineTestSuites(testDriverHNS, GCSFuseCSITestSuitesHNS)
})

testDriverHNSAndGrpc := specs.InitGCSFuseCSITestDriver(c, m, *bucketLocation, *skipGcpSaTest, true, true)

ginkgo.Context(fmt.Sprintf("[Driver: %s HNS + GRPC]", testDriverHNSAndGrpc.GetDriverInfo().Name), func() {
storageframework.DefineTestSuites(testDriverHNSAndGrpc, GCSFuseCSITestSuitesHNS)
})

GCSFuseCSITestSuitesGRPC := []func() storageframework.TestSuite{
testsuites.InitGcsFuseCSIGCSFuseIntegrationTestSuite,
testsuites.InitGcsFuseCSIGCSFuseIntegrationFileCacheTestSuite,
testsuites.InitGcsFuseCSIGCSFuseIntegrationFileCacheParallelDownloadsTestSuite,
}

testDriverGRPC := specs.InitGCSFuseCSITestDriver(c, m, *bucketLocation, *skipGcpSaTest, false, true)

ginkgo.Context(fmt.Sprintf("[Driver: %s GRPC]", testDriverGRPC.GetDriverInfo().Name), func() {
storageframework.DefineTestSuites(testDriverGRPC, GCSFuseCSITestSuitesGRPC)
})
})
2 changes: 1 addition & 1 deletion test/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var (
ginkgoFocus = flag.String("ginkgo-focus", "", "pass to ginkgo run --focus flag")
ginkgoSkip = flag.String("ginkgo-skip", "", "pass to ginkgo run --skip flag")
ginkgoProcs = flag.String("ginkgo-procs", "10", "pass to ginkgo run --procs flag")
ginkgoTimeout = flag.String("ginkgo-timeout", "4h", "pass to ginkgo run --timeout flag")
ginkgoTimeout = flag.String("ginkgo-timeout", "8h", "pass to ginkgo run --timeout flag")
ginkgoFlakeAttempts = flag.String("ginkgo-flake-attempts", "2", "pass to ginkgo run --flake-attempts flag")
ginkgoSkipGcpSaTest = flag.Bool("ginkgo-skip-gcp-sa-test", true, "skip GCP SA test")
)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run-e2e-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ readonly cloudsdk_api_endpoint_overrides_container=${CLOUDSDK_API_ENDPOINT_OVERR
readonly use_gke_managed_driver="${USE_GKE_MANAGED_DRIVER:-true}"
readonly ginkgo_focus="${TEST_FOCUS:-}"
readonly ginkgo_skip="${TEST_SKIP:-}"
readonly ginkgo_timeout="${E2E_TEST_GINKGO_TIMEOUT:-4h}"
readonly ginkgo_timeout="${E2E_TEST_GINKGO_TIMEOUT:-8h}"
readonly ginkgo_procs="${E2E_TEST_GINKGO_PROCS:-20}"
readonly boskos_resource_type="${GCE_PD_BOSKOS_RESOURCE_TYPE:-gke-internal-project}"
readonly gke_cluster_version=${GKE_CLUSTER_VERSION:-latest}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run-e2e-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ readonly build_gcs_fuse_csi_driver="${E2E_TEST_BUILD_DRIVER:-false}"
readonly ginkgo_focus="${E2E_TEST_FOCUS:-}"
readonly ginkgo_skip="${E2E_TEST_SKIP:-should.succeed.in.performance.test}"
readonly ginkgo_procs="${E2E_TEST_GINKGO_PROCS:-10}"
readonly ginkgo_timeout="${E2E_TEST_GINKGO_TIMEOUT:-4h}"
readonly ginkgo_timeout="${E2E_TEST_GINKGO_TIMEOUT:-8h}"
readonly ginkgo_flake_attempts="${E2E_TEST_GINKGO_FLAKE_ATTEMPTS:-2}"

# Initialize ginkgo.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const (
pollInterval = 1 * time.Second
pollTimeout = 1 * time.Minute
pollIntervalSlow = 10 * time.Second
pollTimeoutSlow = 20 * time.Minute
pollTimeoutSlow = 30 * time.Minute
)

type TestPod struct {
Expand Down
8 changes: 7 additions & 1 deletion test/e2e/specs/testdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type GCSFuseCSITestDriver struct {
bucketLocation string
skipGcpSaTest bool
EnableHierarchicalNamespace bool
EnableGrpc bool
}

type gcsVolume struct {
Expand All @@ -62,7 +63,7 @@ type gcsVolume struct {
}

// InitGCSFuseCSITestDriver returns GCSFuseCSITestDriver that implements TestDriver interface.
func InitGCSFuseCSITestDriver(c clientset.Interface, m metadata.Service, bl string, skipGcpSaTest, enableHierarchicalNamespace bool) storageframework.TestDriver {
func InitGCSFuseCSITestDriver(c clientset.Interface, m metadata.Service, bl string, skipGcpSaTest, enableHierarchicalNamespace, enableGrpc bool) storageframework.TestDriver {
ssm, err := storage.NewGCSServiceManager()
if err != nil {
e2eframework.Failf("Failed to set up storage service manager: %v", err)
Expand All @@ -87,6 +88,7 @@ func InitGCSFuseCSITestDriver(c clientset.Interface, m metadata.Service, bl stri
bucketLocation: bl,
skipGcpSaTest: skipGcpSaTest,
EnableHierarchicalNamespace: enableHierarchicalNamespace,
EnableGrpc: enableGrpc,
}
}

Expand Down Expand Up @@ -194,6 +196,10 @@ func (n *GCSFuseCSITestDriver) CreateVolume(ctx context.Context, config *storage
}
mountOptions := "logging:severity:info"

if n.EnableGrpc {
mountOptions += ",client-protocol=grpc"
}

switch config.Prefix {
case NonRootVolumePrefix:
mountOptions += ",uid=1001"
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/testsuites/gcsfuse_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ func hnsEnabled(driver storageframework.TestDriver) bool {
return gcsfuseCSITestDriver.EnableHierarchicalNamespace
}

func grpcEnabled(driver storageframework.TestDriver) bool {
gcsfuseCSITestDriver, ok := driver.(*specs.GCSFuseCSITestDriver)
gomega.Expect(ok).To(gomega.BeTrue(), "failed to cast storageframework.TestDriver to *specs.GCSFuseCSITestDriver")

return gcsfuseCSITestDriver.EnableGrpc
}

type gcsFuseCSIGCSFuseIntegrationTestSuite struct {
tsInfo storageframework.TestSuiteInfo
}
Expand Down Expand Up @@ -133,6 +140,11 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
}
}

// GRPC is supported after v2.5.1
if !v.AtLeast(version.MustParseSemantic("v2.5.1-gke.0")) && grpcEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration GRPC tests on gcsfuse version %v", v.String())
}

// HNS is supported after v2.5.0
if !v.AtLeast(version.MustParseSemantic("v2.5.0-gke.0")) && hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration HNS tests on gcsfuse version %v", v.String())
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/testsuites/gcsfuse_integration_file_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func (t *gcsFuseCSIGCSFuseIntegrationFileCacheTestSuite) DefineTests(driver stor
e2eskipper.Skipf("skip gcsfuse integration test %v for gcsfuse version %v", testName, v.String())
}

// GRPC is supported after v2.5.1
if !v.AtLeast(version.MustParseSemantic("v2.5.1-gke.0")) && grpcEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration GRPC tests on gcsfuse version %v", v.String())
}

// HNS is supported after v2.5.0
if !v.AtLeast(version.MustParseSemantic("v2.5.0-gke.0")) && hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration HNS tests on gcsfuse version %v", v.String())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func (t *gcsFuseCSIGCSFuseIntegrationFileCacheParallelDownloadsTestSuite) Define
e2eskipper.Skipf("skip gcsfuse integration test %v for gcsfuse version %v", testName, v.String())
}

// GRPC is supported after v2.5.1
if !v.AtLeast(version.MustParseSemantic("v2.5.1-gke.0")) && grpcEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration GRPC tests on gcsfuse version %v", v.String())
}

// HNS is supported after v2.5.0
if !v.AtLeast(version.MustParseSemantic("v2.5.0-gke.0")) && hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration HNS tests on gcsfuse version %v", v.String())
Expand Down

0 comments on commit add2858

Please sign in to comment.