From d3fb119d3bb2fc52785e75afd3d4a4036cb70418 Mon Sep 17 00:00:00 2001 From: hime Date: Tue, 10 Dec 2024 23:33:03 +0000 Subject: [PATCH] GRPC e2e tests. --- test/e2e/e2e_test.go | 5 +++-- test/e2e/main.go | 2 ++ test/e2e/run-e2e-ci.sh | 2 ++ test/e2e/specs/testdriver.go | 8 +++++++- test/e2e/testsuites/gcsfuse_integration.go | 4 ++++ test/e2e/testsuites/gcsfuse_integration_file_cache.go | 4 ++++ .../gcsfuse_integration_file_cache_parallel_downloads.go | 4 ++++ test/e2e/utils/handler.go | 2 ++ 8 files changed, 28 insertions(+), 3 deletions(-) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 349ca14bb..40fdb4039 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -41,6 +41,7 @@ var ( err error c clientset.Interface m metadata.Service + clientProtocol = flag.String("client-protocol", "http", "the test bucket location") bucketLocation = flag.String("test-bucket-location", "us-central1", "the test bucket location") skipGcpSaTest = flag.Bool("skip-gcp-sa-test", true, "skip GCP SA test") apiEnv = flag.String("api-env", "prod", "cluster API env") @@ -114,7 +115,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, *clientProtocol) ginkgo.Context(fmt.Sprintf("[Driver: %s]", testDriver.GetDriverInfo().Name), func() { storageframework.DefineTestSuites(testDriver, GCSFuseCSITestSuites) @@ -126,7 +127,7 @@ 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, *clientProtocol) ginkgo.Context(fmt.Sprintf("[Driver: %s HNS]", testDriverHNS.GetDriverInfo().Name), func() { storageframework.DefineTestSuites(testDriverHNS, GCSFuseCSITestSuitesHNS) diff --git a/test/e2e/main.go b/test/e2e/main.go index 4c8ec2ce9..0338640d9 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -51,6 +51,7 @@ var ( buildArm = flag.Bool("build-arm", false, "whether or not to build the image for Arm nodes") deployOverlayName = flag.String("deploy-overlay-name", "stable", "which kustomize overlay to deploy the driver with") useGKEManagedDriver = flag.Bool("use-gke-managed-driver", false, "use GKE managed GCS FUSE CSI driver for the tests") + gcsfuseClientProtocol = flag.String("gcsfuse-client-protocol", "http", "type of protocol gcsfuse uses to communicate with gcs") // Ginkgo flags. ginkgoFocus = flag.String("ginkgo-focus", "", "pass to ginkgo run --focus flag") @@ -103,6 +104,7 @@ func main() { GinkgoFlakeAttempts: *ginkgoFlakeAttempts, GinkgoSkipGcpSaTest: *ginkgoSkipGcpSaTest, IstioVersion: *istioVersion, + GcsfuseClientProtocol: *gcsfuseClientProtocol, } if strings.Contains(testParams.GinkgoFocus, "performance") { diff --git a/test/e2e/run-e2e-ci.sh b/test/e2e/run-e2e-ci.sh index be69958be..032573517 100755 --- a/test/e2e/run-e2e-ci.sh +++ b/test/e2e/run-e2e-ci.sh @@ -36,6 +36,7 @@ readonly gke_cluster_version=${GKE_CLUSTER_VERSION:-latest} readonly gke_node_version=${GKE_NODE_VERSION:-} readonly node_machine_type=${MACHINE_TYPE:-n2-standard-4} readonly number_nodes=${NUMBER_NODES:-3} +readonly gcsfuse_client_protocol=${GCSFUSE_CLIENT_PROTOCOL:-http} # Install golang version=1.22.7 @@ -69,6 +70,7 @@ base_cmd="${PKGDIR}/bin/e2e-test-ci \ --gke-cluster-version=${gke_cluster_version} \ --gke-node-version=${gke_node_version} \ --node-machine-type=${node_machine_type} \ + --gcsfuse-client-protocol=${gcsfuse_client_protocol} \ --number-nodes=${number_nodes}" eval "$base_cmd" \ No newline at end of file diff --git a/test/e2e/specs/testdriver.go b/test/e2e/specs/testdriver.go index d389a773e..96c28dbff 100644 --- a/test/e2e/specs/testdriver.go +++ b/test/e2e/specs/testdriver.go @@ -45,6 +45,7 @@ type GCSFuseCSITestDriver struct { storageServiceManager storage.ServiceManager volumeStore []*gcsVolume bucketLocation string + ClientProtocol string skipGcpSaTest bool EnableHierarchicalNamespace bool } @@ -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 bool, clientProtocol string) storageframework.TestDriver { ssm, err := storage.NewGCSServiceManager() if err != nil { e2eframework.Failf("Failed to set up storage service manager: %v", err) @@ -86,6 +87,7 @@ func InitGCSFuseCSITestDriver(c clientset.Interface, m metadata.Service, bl stri volumeStore: []*gcsVolume{}, bucketLocation: bl, skipGcpSaTest: skipGcpSaTest, + ClientProtocol: clientProtocol, EnableHierarchicalNamespace: enableHierarchicalNamespace, } } @@ -194,6 +196,10 @@ func (n *GCSFuseCSITestDriver) CreateVolume(ctx context.Context, config *storage } mountOptions := "logging:severity:info" + if n.ClientProtocol == "grpc" { + mountOptions += ",client-protocol=grpc" + } + switch config.Prefix { case NonRootVolumePrefix: mountOptions += ",uid=1001" diff --git a/test/e2e/testsuites/gcsfuse_integration.go b/test/e2e/testsuites/gcsfuse_integration.go index c2769c78c..f19450f3b 100644 --- a/test/e2e/testsuites/gcsfuse_integration.go +++ b/test/e2e/testsuites/gcsfuse_integration.go @@ -117,6 +117,10 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew framework.ExpectNoError(err, "while cleaning up") } + // skipTestOrProceedWithBranch works by skipping tests for gcsfuse versions that do not support them. + // These tests run against all non-managed driver versions, and for selected gke managed driver versions. This is because when + // we build the non-managed driver, we build gcsfuse from master and assign a tag of 999 to that build. This automatically + // qualifies the non-managed driver to run all the tests. skipTestOrProceedWithBranch := func(gcsfuseVersionStr, testName string) string { v, err := version.ParseSemantic(gcsfuseVersionStr) // When the gcsfuse binary is built using the head commit in the test pipeline, diff --git a/test/e2e/testsuites/gcsfuse_integration_file_cache.go b/test/e2e/testsuites/gcsfuse_integration_file_cache.go index d4dd222f8..b0f51cddc 100644 --- a/test/e2e/testsuites/gcsfuse_integration_file_cache.go +++ b/test/e2e/testsuites/gcsfuse_integration_file_cache.go @@ -85,6 +85,10 @@ func (t *gcsFuseCSIGCSFuseIntegrationFileCacheTestSuite) DefineTests(driver stor framework.ExpectNoError(err, "while cleaning up") } + // skipTestOrProceedWithBranch works by skipping tests for gcsfuse versions that do not support them. + // These tests run against all non-managed driver versions, and for selected gke managed driver versions. This is because when + // we build the non-managed driver, we build gcsfuse from master and assign a tag of 999 to that build. This automatically + // qualifies the non-managed driver to run all the tests. skipTestOrProceedWithBranch := func(gcsfuseVersionStr, testName string) string { v, err := version.ParseSemantic(gcsfuseVersionStr) // When the gcsfuse binary is built using the head commit in the test pipeline, diff --git a/test/e2e/testsuites/gcsfuse_integration_file_cache_parallel_downloads.go b/test/e2e/testsuites/gcsfuse_integration_file_cache_parallel_downloads.go index ba6d01568..353e14b04 100644 --- a/test/e2e/testsuites/gcsfuse_integration_file_cache_parallel_downloads.go +++ b/test/e2e/testsuites/gcsfuse_integration_file_cache_parallel_downloads.go @@ -85,6 +85,10 @@ func (t *gcsFuseCSIGCSFuseIntegrationFileCacheParallelDownloadsTestSuite) Define framework.ExpectNoError(err, "while cleaning up") } + // skipTestOrProceedWithBranch works by skipping tests for gcsfuse versions that do not support them. + // These tests run against all non-managed driver versions, and for selected gke managed driver versions. This is because when + // we build the non-managed driver, we build gcsfuse from master and assign a tag of 999 to that build. This automatically + // qualifies the non-managed driver to run all the tests. skipTestOrProceedWithBranch := func(gcsfuseVersionStr, testName string) string { v, err := version.ParseSemantic(gcsfuseVersionStr) // When the gcsfuse binary is built using the head commit in the test pipeline, diff --git a/test/e2e/utils/handler.go b/test/e2e/utils/handler.go index d62284a9d..cca922fd7 100644 --- a/test/e2e/utils/handler.go +++ b/test/e2e/utils/handler.go @@ -69,6 +69,7 @@ type TestParameters struct { SupportsNativeSidecar bool IstioVersion string + GcsfuseClientProtocol string } const TestWithNativeSidecarEnvVar = "TEST_WITH_NATIVE_SIDECAR" @@ -190,6 +191,7 @@ func Handle(testParams *TestParameters) error { "--output-dir", artifactsDir, testParams.PkgDir+"/test/e2e/", "--", + "--client-protocol", testParams.GcsfuseClientProtocol, "--provider", "skeleton", "--test-bucket-location", testParams.GkeClusterRegion, "--skip-gcp-sa-test", strconv.FormatBool(testParams.GinkgoSkipGcpSaTest),