Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run gRPC e2e integration tests. #405

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -103,6 +104,7 @@ func main() {
GinkgoFlakeAttempts: *ginkgoFlakeAttempts,
GinkgoSkipGcpSaTest: *ginkgoSkipGcpSaTest,
IstioVersion: *istioVersion,
GcsfuseClientProtocol: *gcsfuseClientProtocol,
}

if strings.Contains(testParams.GinkgoFocus, "performance") {
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/run-e2e-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
8 changes: 7 additions & 1 deletion test/e2e/specs/testdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type GCSFuseCSITestDriver struct {
storageServiceManager storage.ServiceManager
volumeStore []*gcsVolume
bucketLocation string
ClientProtocol string
skipGcpSaTest bool
EnableHierarchicalNamespace bool
}
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 bool, clientProtocol string) storageframework.TestDriver {
ssm, err := storage.NewGCSServiceManager()
if err != nil {
e2eframework.Failf("Failed to set up storage service manager: %v", err)
Expand All @@ -86,6 +87,7 @@ func InitGCSFuseCSITestDriver(c clientset.Interface, m metadata.Service, bl stri
volumeStore: []*gcsVolume{},
bucketLocation: bl,
skipGcpSaTest: skipGcpSaTest,
ClientProtocol: clientProtocol,
EnableHierarchicalNamespace: enableHierarchicalNamespace,
}
}
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/testsuites/gcsfuse_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/testsuites/gcsfuse_integration_file_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/utils/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type TestParameters struct {

SupportsNativeSidecar bool
IstioVersion string
GcsfuseClientProtocol string
}

const TestWithNativeSidecarEnvVar = "TEST_WITH_NATIVE_SIDECAR"
Expand Down Expand Up @@ -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),
Expand Down
Loading