Repository: GoogleCloudPlatform/gcsfuse
Pull request #3155: Fix and enable package list_large_dir in ZB e2e tests
Author: login: gargnitingoogle
Labels: name: execute-integration-tests-on-zb
description: To run E2E tests on zonal bucket.
Created: 2025-04-07T07:52:51Z | Merged: 2025-04-09T23:50:27Z

### Description
* Create the 12k files and 100 implicit directories and 100 explicit directories for testing in ZB using storage-client instead of using gcloud (as `gcloud storage cp` doesn't work for ZB)
  - No change in use of gcloud for non-ZB. This is for speed as creating/copying files in bulk using gcloud (which is highly parallelized) is faster than using storage-client, so leaving part that as it is. We can switch easily for non-ZB later if it makes sense.
* Disable GRPC-specific test for zonal-bucket case, as it's a duplicate, as ZB by default work over GRPC.
* Enable list_large_dir e2e test package for ZB.

### Link to the issue in case of a bug fix.
[b/407894658](http://b/407894658)

### Testing details
1. Manual - NA
2. Unit tests - NA
3. Integration tests - through presubmit - [Passed ZB run](https://fusion2.corp.google.com/ci/kokoro/prod:gcsfuse%2Fgcp_ubuntu%2Fpresubmits%2Fperf_tests%2Fpresubmit/activity/1727612b-d05b-4af3-8643-1d715c2f7761/summary), [Passed non-ZB run](https://fusion2.corp.google.com/ci/kokoro/prod:gcsfuse%2Fgcp_ubuntu%2Fpresubmits%2Fperf_tests%2Fpresubmit/activity/cea37703-8d4e-4264-84c7-c2bd2498426e/summary).

### Any backward incompatible change? If so, please explain.



Diff:
diff --git a/tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go b/tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
index cf73653cde..6071f2ff90 100644
--- a/tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
+++ b/tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
@@ -15,15 +15,20 @@
 package list_large_dir
 
 import (
+	"context"
 	"fmt"
 	"math"
 	"os"
 	"path"
+	"path/filepath"
 	"strconv"
 	"strings"
+	"sync"
 	"testing"
 	"time"
 
+	"cloud.google.com/go/storage"
+	"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/client"
 	. "github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/client"
 	"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/operations"
 	"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/setup"
@@ -99,14 +104,80 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(t *testing.T, bucketNameWithDirPath string) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	var found bool
+	if bucketName, dirPathInBucket, found = strings.Cut(bucketNameWithDirPath, "/"); !found {
+		t.Fatalf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	return
+}
+
+// This function is equivalent to testdata/upload_files_to_bucket.sh to replace gcloud with storage-client
+// This is needed for ZB which is not supported by gcloud storage cp command yet.
+func testdataUploadFilesToBucket(ctx context.Context, t *testing.T, storageClient *storage.Client, bucketNameWithDirPath, dirWith12KFiles, filesPrefix string) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(t, bucketNameWithDirPath)
+
+	dirWith12KFilesFullPathPrefix := filepath.Join(dirWith12KFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWith12KFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWith12KFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGCSObjectPath string
+	}
+	channel := make(chan copyRequest)
+
+	// Copy request producer.
+	go func() {
+		for _, match := range matches {
+			_, fileName := filepath.Split(match)
+			if len(fileName) > 0 {
+				req := copyRequest{srcLocalFilePath: match, dstGCSObjectPath: filepath.Join(dirPathInBucket, fileName)}
+				channel <- req
+			}
+		}
+		// close the channel to let the go-routines know that there is no more object to be copied.
+		close(channel)
+	}()
+
+	// Copy request consumers.
+	numCopyGoroutines := 16
+	var wg sync.WaitGroup
+	for range numCopyGoroutines {
+		wg.Add(1)
+		go func() {
+			defer wg.Done()
+			for {
+				copyRequest, ok := <-channel
+				if !ok {
+					break
+				}
+				client.CopyFileInBucket(ctx, storageClient, copyRequest.srcLocalFilePath, copyRequest.dstGCSObjectPath, bucketName)
+			}
+		}()
+	}
+	wg.Wait()
+}
+
 // createFilesAndUpload generates files and uploads them to the specified directory.
 func createFilesAndUpload(t *testing.T, dirPath string) {
 	t.Helper()
 
 	localDirPath := path.Join(os.Getenv("HOME"), directoryWithTwelveThousandFiles)
 	operations.CreateDirectoryWithNFiles(numberOfFilesInDirectoryWithTwelveThousandFiles, localDirPath, prefixFileInDirectoryWithTwelveThousandFiles, t)
+	defer os.RemoveAll(localDirPath)
 
-	setup.RunScriptForTestData("testdata/upload_files_to_bucket.sh", dirPath, localDirPath, prefixFileInDirectoryWithTwelveThousandFiles)
+	if setup.IsZonalBucketRun() {
+		testdataUploadFilesToBucket(ctx, t, storageClient, dirPath, localDirPath, prefixFileInDirectoryWithTwelveThousandFiles)
+	} else {
+		setup.RunScriptForTestData("testdata/upload_files_to_bucket.sh", dirPath, localDirPath, prefixFileInDirectoryWithTwelveThousandFiles)
+	}
 }
 
 // createExplicitDirs creates empty explicit directories in the specified directory.
@@ -150,6 +221,22 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+// This function is equivalent to testdata/create_implicit_dir.sh to replace gcloud with storage-client
+// This is needed for ZB which is not supported by gcloud storage cp command yet.
+func testdataCreateImplicitDir(ctx context.Context, t *testing.T, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(t, bucketNameWithDirPath)
+
+	testFile, err := operations.CreateLocalTempFile("", false)
+	if err != nil {
+		t.Fatalf("Failed to create local file for creating copies ...")
+	}
+	for suffix := 1; suffix <= numberOfImplicitDirsInDirectory; suffix++ {
+		client.CopyFileInBucket(ctx, storageClient, testFile, path.Join(dirPathInBucket, fmt.Sprintf("%s%d", prefixImplicitDirInLargeDirListTest, suffix), testFile), bucketName)
+	}
+}
+
 // prepareTestDirectory sets up a test directory with files and required explicit and implicit directories.
 func prepareTestDirectory(t *testing.T, withExplicitDirs bool, withImplicitDirs bool) string {
 	t.Helper()
@@ -169,7 +256,11 @@ func prepareTestDirectory(t *testing.T, withExplicitDirs bool, withImplicitDirs
 	}
 
 	if withImplicitDirs {
-		setup.RunScriptForTestData("testdata/create_implicit_dir.sh", testDirPathOnBucket, prefixImplicitDirInLargeDirListTest, strconv.Itoa(numberOfImplicitDirsInDirectoryWithTwelveThousandFiles))
+		if setup.IsZonalBucketRun() {
+			testdataCreateImplicitDir(ctx, t, storageClient, testDirPathOnBucket, prefixImplicitDirInLargeDirListTest, numberOfImplicitDirsInDirectoryWithTwelveThousandFiles)
+		} else {
+			setup.RunScriptForTestData("testdata/create_implicit_dir.sh", testDirPathOnBucket, prefixImplicitDirInLargeDirListTest, strconv.Itoa(numberOfImplicitDirsInDirectoryWithTwelveThousandFiles))
+		}
 	}
 
 	return testDirPath
diff --git a/tools/integration_tests/list_large_dir/list_large_dir_test.go b/tools/integration_tests/list_large_dir/list_large_dir_test.go
index 7e49d325bc..5958e855e5 100644
--- a/tools/integration_tests/list_large_dir/list_large_dir_test.go
+++ b/tools/integration_tests/list_large_dir/list_large_dir_test.go
@@ -54,7 +54,9 @@ func TestMain(m *testing.M) {
 	}()
 
 	flags := [][]string{{"--implicit-dirs", "--stat-cache-ttl=0", "--kernel-list-cache-ttl-secs=-1"}}
-	if !testing.Short() {
+	// Don't run for grpc if -short flat is passed.
+	// Don't run for grpc for zonal bucket as zonal buckets by default use grpc.
+	if !testing.Short() && !setup.IsZonalBucketRun() {
 		flags = append(flags, []string{"--client-protocol=grpc", "--implicit-dirs=true", "--stat-cache-ttl=0", "--kernel-list-cache-ttl-secs=-1"})
 	}
 
diff --git a/tools/integration_tests/run_e2e_tests.sh b/tools/integration_tests/run_e2e_tests.sh
index ae966f9ba8..46836780fb 100755
--- a/tools/integration_tests/run_e2e_tests.sh
+++ b/tools/integration_tests/run_e2e_tests.sh
@@ -127,7 +127,7 @@ TEST_DIR_PARALLEL_FOR_ZB=(
   # "implicit_dir"
   "interrupt"
   "kernel_list_cache"
-  # "list_large_dir"
+  "list_large_dir"
   "local_file"
   "log_rotation"
   "monitoring"
diff --git a/tools/integration_tests/util/client/storage_client.go b/tools/integration_tests/util/client/storage_client.go
index 24a5e20211..0a99989580 100644
--- a/tools/integration_tests/util/client/storage_client.go
+++ b/tools/integration_tests/util/client/storage_client.go
@@ -378,7 +378,7 @@ func ClearCacheControlOnGcsObject(ctx context.Context, client *storage.Client, o
 func CopyFileInBucket(ctx context.Context, storageClient *storage.Client, srcfilePath, destFilePath, bucket string) {
 	err := UploadGcsObject(ctx, storageClient, srcfilePath, bucket, destFilePath, false)
 	if err != nil {
-		log.Fatalf("Error while copying file in bucket: %v", err)
+		log.Fatalf("Error while copying file %q to GCS object \"gs://%s/%s\" : %v", srcfilePath, bucket, destFilePath, err)
 	}
 }
 


Reviews:
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T14:46:48Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T14:48:28Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T17:38:58Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T18:12:45Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T18:12:57Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T18:13:03Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T18:41:33Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T18:43:09Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T04:15:21Z
user: login: kislaykishore
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-09T05:29:35Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:03:05Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:03:34Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:14:47Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:14:53Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:02Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:06Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:12Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:25Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:31Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:38Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:45Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:15:51Z
user: login: kislaykishore
state: DISMISSED
author_association: COLLABORATOR
submitted_at: 2025-04-09T14:39:47Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T19:18:51Z
user: login: gargnitingoogle
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T19:18:57Z
user: login: kislaykishore
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-09T23:50:25Z

Review comments:
diff_hunk: @@ -99,14 +103,42 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	fmt.Printf("Copying files from %q to gs://%s/%s/ ...\n", dirWithTwelveThousandFiles, bucketName, dirPathInBucket)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Remove this debug log.
created_at: 2025-04-08T12:03:52Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +103,42 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Put a line gap here.
created_at: 2025-04-08T12:04:02Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +103,42 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Put a line gap here.
created_at: 2025-04-08T12:04:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +103,42 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	fmt.Printf("Copying files from %q to gs://%s/%s/ ...\n", dirWithTwelveThousandFiles, bucketName, dirPathInBucket)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			client.CopyFileInBucket(ctx, storageClient, match, filepath.Join(dirPathInBucket, fileName), bucketName)
+		}
+	}
+}
+
 // createFilesAndUpload generates files and uploads them to the specified directory.
 func createFilesAndUpload(t *testing.T, dirPath string) {
 	t.Helper()
 
 	localDirPath := path.Join(os.Getenv("HOME"), directoryWithTwelveThousandFiles)
+	fmt.Printf("Creating %d files in %q with prefix %q ...\n", numberOfFilesInDirectoryWithTwelveThousandFiles, localDirPath, prefixFileInDirectoryWithTwelveThousandFiles)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Remove this debug log.
created_at: 2025-04-08T12:05:13Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +103,42 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-08T14:46:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +103,42 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-08T14:46:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +103,42 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	fmt.Printf("Copying files from %q to gs://%s/%s/ ...\n", dirWithTwelveThousandFiles, bucketName, dirPathInBucket)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-08T14:46:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,72 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	fmt.Printf("Copying files from %q to gs://%s/%s/ ...\n", dirWithTwelveThousandFiles, bucketName, dirPathInBucket)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numChannels := 16
+	channels := make([]chan copyRequest, numChannels)
+	counter := 0
+	perChannelCapacity := int(math.Ceil(float64(numberOfFilesInDirectoryWithTwelveThousandFiles) / float64(numChannels)))
+	for i := 0; i < numChannels; i++ {
+		channels[i] = make(chan copyRequest, perChannelCapacity)
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			chanIndex := counter % numChannels
+			channels[chanIndex] <- copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)}
+			counter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
+	for chanIndex := 0; chanIndex < numChannels; chanIndex++ {
+		wg.Add(1)
+		close(channels[chanIndex])
+		go func() {
+			for metadata := range channels[chanIndex] {
+				//fmt.Printf("Copying %q to gs:/%s/%s ...\n", metadata.srcLocalFilePath, bucketName, metadata.dstGcsObjectPath)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Remove commented out lines
created_at: 2025-04-08T14:47:59Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,72 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	fmt.Printf("Copying files from %q to gs://%s/%s/ ...\n", dirWithTwelveThousandFiles, bucketName, dirPathInBucket)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numChannels := 16
+	channels := make([]chan copyRequest, numChannels)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Switch from channels to regular arrays or queues.
created_at: 2025-04-08T14:48:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,6 +213,23 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDirUsingStorageClient(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
+	t.Helper()
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Move this common code out.
created_at: 2025-04-08T17:38:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,6 +213,23 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDirUsingStorageClient(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
+	t.Helper()
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-08T18:12:41Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,72 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	fmt.Printf("Copying files from %q to gs://%s/%s/ ...\n", dirWithTwelveThousandFiles, bucketName, dirPathInBucket)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numChannels := 16
+	channels := make([]chan copyRequest, numChannels)
+	counter := 0
+	perChannelCapacity := int(math.Ceil(float64(numberOfFilesInDirectoryWithTwelveThousandFiles) / float64(numChannels)))
+	for i := 0; i < numChannels; i++ {
+		channels[i] = make(chan copyRequest, perChannelCapacity)
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			chanIndex := counter % numChannels
+			channels[chanIndex] <- copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)}
+			counter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
+	for chanIndex := 0; chanIndex < numChannels; chanIndex++ {
+		wg.Add(1)
+		close(channels[chanIndex])
+		go func() {
+			for metadata := range channels[chanIndex] {
+				//fmt.Printf("Copying %q to gs:/%s/%s ...\n", metadata.srcLocalFilePath, bucketName, metadata.dstGcsObjectPath)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-08T18:12:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,72 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName := bucketNameWithDirPath[:idx]
+	dirPathInBucket := bucketNameWithDirPath[idx+1:]
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	fmt.Printf("Copying files from %q to gs://%s/%s/ ...\n", dirWithTwelveThousandFiles, bucketName, dirPathInBucket)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numChannels := 16
+	channels := make([]chan copyRequest, numChannels)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-08T18:13:03Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: nit: Add comment indicating that this function is equivalent to testdata/upload_files_to_bucket.sh 
created_at: 2025-04-08T18:41:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,6 +216,20 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDir(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: nit: Add comment indicating that this function is equivalent to testdata/create_implicit_dir.sh 
created_at: 2025-04-08T18:41:30Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: nit: Add comments explaining the logic.
created_at: 2025-04-08T18:42:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,6 +216,20 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDir(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	testFile, err := operations.CreateLocalTempFile("", false)
+	if err != nil {
+		t.Fatalf("Failed to local file for creating copies ...")
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: nit: error log typo

```suggestion
		t.Fatalf("Failed to create local file for creating copies ...")
```
created_at: 2025-04-09T04:15:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: ```suggestion
	bucketName, dirPathInBucket, err := strings.Cut(bucketNameWithDirPath, "/")
	if err != nil {
	  t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>: %v", bucketNameWithDirPath, err)
	}
	return bucketName, dirPathInBucket
```
created_at: 2025-04-09T04:25:51Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numCopyGoroutines := 16
+	copyGoroutines := make([][]copyRequest, numCopyGoroutines)
+	copyRequestCounter := 0
+	for i := 0; i < numCopyGoroutines; i++ {
+		copyGoroutines[i] = []copyRequest{}
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			copyGoroutineIndex := copyRequestCounter % numCopyGoroutines
+			copyGoroutines[copyGoroutineIndex] = append(copyGoroutines[copyGoroutineIndex], copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)})
+			copyRequestCounter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: Idiomatic Golang
```suggestion
	var wg sync.WaitGroup
```
created_at: 2025-04-09T04:33:23Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: Idiomatic golang - context and testing.T should be the first parameters in a function.
```suggestion
func testdataUploadFilesToBucket(ctx context.Context, t *testing.T, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string) {
```
created_at: 2025-04-09T04:49:23Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: The long variable names - seems like we are in Java world! Could we use a smaller name like: dirWith12KFilesFullPathPrefix
created_at: 2025-04-09T05:00:57Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: ```suggestion
		dstGCSObjectPath string
```
created_at: 2025-04-09T05:01:14Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numCopyGoroutines := 16
+	copyGoroutines := make([][]copyRequest, numCopyGoroutines)
+	copyRequestCounter := 0
+	for i := 0; i < numCopyGoroutines; i++ {
+		copyGoroutines[i] = []copyRequest{}
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			copyGoroutineIndex := copyRequestCounter % numCopyGoroutines
+			copyGoroutines[copyGoroutineIndex] = append(copyGoroutines[copyGoroutineIndex], copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)})
+			copyRequestCounter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
+	for _, copyGoroutine := range copyGoroutines {
+		wg.Add(1)
+		go func() {
+			for _, copyRequest := range copyGoroutine {
+				client.CopyFileInBucket(ctx, storageClient, copyRequest.srcLocalFilePath, copyRequest.dstGcsObjectPath, bucketName)
+			}
+			wg.Done()
+		}()
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: Idiomatic golang
```suggestion
		go func() {
		        defer wg.Done()
			for _, copyRequest := range copyGoroutine {
				client.CopyFileInBucket(ctx, storageClient, copyRequest.srcLocalFilePath, copyRequest.dstGcsObjectPath, bucketName)
			}
			
		}()
```
created_at: 2025-04-09T05:10:46Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numCopyGoroutines := 16
+	copyGoroutines := make([][]copyRequest, numCopyGoroutines)
+	copyRequestCounter := 0
+	for i := 0; i < numCopyGoroutines; i++ {
+		copyGoroutines[i] = []copyRequest{}
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			copyGoroutineIndex := copyRequestCounter % numCopyGoroutines
+			copyGoroutines[copyGoroutineIndex] = append(copyGoroutines[copyGoroutineIndex], copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)})
+			copyRequestCounter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
+	for _, copyGoroutine := range copyGoroutines {
+		wg.Add(1)
+		go func() {
+			for _, copyRequest := range copyGoroutine {
+				client.CopyFileInBucket(ctx, storageClient, copyRequest.srcLocalFilePath, copyRequest.dstGcsObjectPath, bucketName)
+			}
+			wg.Done()
+		}()
+	}
+	wg.Wait()
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: Use channels to limit concurrency.
```suggestion
	numCopyGoroutines := 16
	ch := make(chan copyRequest, numCopyGoroutines)
	go func() {
	  for _, match := range matches {
	    if len(fileName) == 0 {
	      continue
	    }
	    ch <- copyRequest{
	        srcLocalFilePath: match,
	        dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName),
	      }
	  }
	  close(ch)
	}()
	for {
	  select {
	    case cpReq, ok := <- ch:
	      if !ok {
	        break
	      }
	      client.CopyFileInBucket(ctx, storageClient, cpReq.srcLocalFilePath, cpReq.dstGcsObjectPath, bucketName)	      
	  }
	}
```
created_at: 2025-04-09T05:26:17Z
author_association: COLLABORATOR
diff_hunk: @@ -150,6 +216,20 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDir(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	testFile, err := operations.CreateLocalTempFile("", false)
+	if err != nil {
+		t.Fatalf("Failed to local file for creating copies ...")
+	}
+	for a := 1; a <= numberOfImplicitDirsInDirectory; a++ {
+		client.CopyFileInBucket(ctx, storageClient, testFile, path.Join(dirPathInBucket, prefixImplicitDirInLargeDirListTest+fmt.Sprintf("%d", a), testFile), bucketName)
+	}
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: ```suggestion
	for suffix := 1; suffix <= numberOfImplicitDirsInDirectory; suffix++ {
		client.CopyFileInBucket(ctx, storageClient, testFile, path.Join(dirPathInBucket,fmt.Sprintf("%s%d", prefixImplicitDirInLargeDirListTest, suffix), testFile), bucketName)
	}
```
created_at: 2025-04-09T05:28:58Z
author_association: COLLABORATOR
diff_hunk: @@ -150,6 +216,20 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDir(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	testFile, err := operations.CreateLocalTempFile("", false)
+	if err != nil {
+		t.Fatalf("Failed to local file for creating copies ...")
+	}
+	for a := 1; a <= numberOfImplicitDirsInDirectory; a++ {
+		client.CopyFileInBucket(ctx, storageClient, testFile, path.Join(dirPathInBucket, prefixImplicitDirInLargeDirListTest+fmt.Sprintf("%d", a), testFile), bucketName)
+	}
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:03:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numCopyGoroutines := 16
+	copyGoroutines := make([][]copyRequest, numCopyGoroutines)
+	copyRequestCounter := 0
+	for i := 0; i < numCopyGoroutines; i++ {
+		copyGoroutines[i] = []copyRequest{}
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			copyGoroutineIndex := copyRequestCounter % numCopyGoroutines
+			copyGoroutines[copyGoroutineIndex] = append(copyGoroutines[copyGoroutineIndex], copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)})
+			copyRequestCounter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
+	for _, copyGoroutine := range copyGoroutines {
+		wg.Add(1)
+		go func() {
+			for _, copyRequest := range copyGoroutine {
+				client.CopyFileInBucket(ctx, storageClient, copyRequest.srcLocalFilePath, copyRequest.dstGcsObjectPath, bucketName)
+			}
+			wg.Done()
+		}()
+	}
+	wg.Wait()
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: Done. Switched to a single unbuffered channel as discussed offline.

Stats associated with this change:

time taken to copy all  1000   files, using arrays in goroutines                               =    7.929863456s
time taken to copy all  1000   files, using arrays in goroutines                               =    6.787053469s
time taken to copy all  1000   files, using arrays in goroutines                               =    6.375443899s
time taken to copy all  1000   files, using a single buffered channel across all goroutines    =    7.851011189s
time taken to copy all  1000   files, using a single buffered channel across all goroutines    =    6.51152162s
time taken to copy all  1000   files, using a single buffered channel across all goroutines    =    6.14107131s
time taken to copy all  1000   files, using a single unbuffered channel across all goroutines  =    7.013791204s
time taken to copy all  1000   files, using a single unbuffered channel across all goroutines  =    6.269052254s
time taken to copy all  1000   files, using a single unbuffered channel across all goroutines  =    6.056092328s
time taken to copy all  12000  files, using a single unbuffered channel across all goroutines  =  1m7.534551842s
time taken to copy all  12000  files, using a single unbuffered channel across all goroutines  =  1m5.070493206s
time taken to copy all  12000  filesi, using a single unbuffered channel across all goroutines =  1m4.751596961s
created_at: 2025-04-09T11:03:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:14:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:14:53Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:02Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numCopyGoroutines := 16
+	copyGoroutines := make([][]copyRequest, numCopyGoroutines)
+	copyRequestCounter := 0
+	for i := 0; i < numCopyGoroutines; i++ {
+		copyGoroutines[i] = []copyRequest{}
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			copyGoroutineIndex := copyRequestCounter % numCopyGoroutines
+			copyGoroutines[copyGoroutineIndex] = append(copyGoroutines[copyGoroutineIndex], copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)})
+			copyRequestCounter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
+	for _, copyGoroutine := range copyGoroutines {
+		wg.Add(1)
+		go func() {
+			for _, copyRequest := range copyGoroutine {
+				client.CopyFileInBucket(ctx, storageClient, copyRequest.srcLocalFilePath, copyRequest.dstGcsObjectPath, bucketName)
+			}
+			wg.Done()
+		}()
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:12Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:31Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,75 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(bucketNameWithDirPath string, t *testing.T) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	idx := strings.Index(bucketNameWithDirPath, "/")
+	if idx <= 0 {
+		t.Errorf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	bucketName = bucketNameWithDirPath[:idx]
+	dirPathInBucket = bucketNameWithDirPath[idx+1:]
+	return
+}
+
+func testdataUploadFilesToBucket(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, dirWithTwelveThousandFiles, filesPrefix string, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	dirWithTwelveThousandFilesFullPathPrefix := filepath.Join(dirWithTwelveThousandFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWithTwelveThousandFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWithTwelveThousandFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGcsObjectPath string
+	}
+	numCopyGoroutines := 16
+	copyGoroutines := make([][]copyRequest, numCopyGoroutines)
+	copyRequestCounter := 0
+	for i := 0; i < numCopyGoroutines; i++ {
+		copyGoroutines[i] = []copyRequest{}
+	}
+
+	for _, match := range matches {
+		_, fileName := filepath.Split(match)
+		if len(fileName) > 0 {
+			copyGoroutineIndex := copyRequestCounter % numCopyGoroutines
+			copyGoroutines[copyGoroutineIndex] = append(copyGoroutines[copyGoroutineIndex], copyRequest{srcLocalFilePath: match, dstGcsObjectPath: filepath.Join(dirPathInBucket, fileName)})
+			copyRequestCounter++
+		}
+	}
+
+	wg := sync.WaitGroup{}
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:38Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,6 +216,20 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDir(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(bucketNameWithDirPath, t)
+
+	testFile, err := operations.CreateLocalTempFile("", false)
+	if err != nil {
+		t.Fatalf("Failed to local file for creating copies ...")
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,6 +216,20 @@ func listDirTime(t *testing.T, dirPath string, expectExplicitDirs bool, expectIm
 	return firstListTime, minSecondListTime
 }
 
+func testdataCreateImplicitDir(ctx context.Context, storageClient *storage.Client, bucketNameWithDirPath, prefixImplicitDirInLargeDirListTest string, numberOfImplicitDirsInDirectory int, t *testing.T) {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T11:15:51Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,81 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(t *testing.T, bucketNameWithDirPath string) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	var found bool
+	bucketName, dirPathInBucket, found = strings.Cut(bucketNameWithDirPath, "/")
+	if !found {
+		t.Fatalf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: Nit
```suggestion
	if bucketName, dirPathInBucket, found := strings.Cut(bucketNameWithDirPath, "/"); !found {
		t.Fatalf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
	}
```
created_at: 2025-04-09T14:12:24Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,81 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(t *testing.T, bucketNameWithDirPath string) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	var found bool
+	bucketName, dirPathInBucket, found = strings.Cut(bucketNameWithDirPath, "/")
+	if !found {
+		t.Fatalf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	return
+}
+
+// This function is equivalent to testdata/upload_files_to_bucket.sh to replace gcloud with storage-client
+// This is needed for ZB which is not supported by gcloud storage cp command yet.
+func testdataUploadFilesToBucket(ctx context.Context, t *testing.T, storageClient *storage.Client, bucketNameWithDirPath, dirWith12KFiles, filesPrefix string) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(t, bucketNameWithDirPath)
+
+	dirWith12KFilesFullPathPrefix := filepath.Join(dirWith12KFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWith12KFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWith12KFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGCSObjectPath string
+	}
+	channel := make(chan copyRequest)
+
+	// Copy request producer.
+	go func() {
+		for _, match := range matches {
+			_, fileName := filepath.Split(match)
+			if len(fileName) > 0 {
+				req := copyRequest{srcLocalFilePath: match, dstGCSObjectPath: filepath.Join(dirPathInBucket, fileName)}
+				channel <- req
+			}
+		}
+		// close the channel to let the go-routines know that there is no more object to be copied.
+		close(channel)
+	}()
+
+	// Copy request consumers.
+	numCopyGoroutines := 16
+	var wg sync.WaitGroup
+	for copyGoroutine := 0; copyGoroutine < numCopyGoroutines; copyGoroutine++ {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: kislaykishore
body: Nit
```suggestion
	for range numCopyGoroutines {
```
created_at: 2025-04-09T14:14:56Z
author_association: COLLABORATOR
diff_hunk: @@ -99,14 +104,81 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(t *testing.T, bucketNameWithDirPath string) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	var found bool
+	bucketName, dirPathInBucket, found = strings.Cut(bucketNameWithDirPath, "/")
+	if !found {
+		t.Fatalf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T19:18:51Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,14 +104,81 @@ func checkIfObjNameIsCorrect(t *testing.T, objName string, prefix string, maxNum
 	}
 }
 
+func splitBucketNameAndDirPath(t *testing.T, bucketNameWithDirPath string) (bucketName, dirPathInBucket string) {
+	t.Helper()
+
+	var found bool
+	bucketName, dirPathInBucket, found = strings.Cut(bucketNameWithDirPath, "/")
+	if !found {
+		t.Fatalf("Unexpected bucketNameWithDirPath: %q. Expected form: <bucket>/<object-name>", bucketNameWithDirPath)
+	}
+	return
+}
+
+// This function is equivalent to testdata/upload_files_to_bucket.sh to replace gcloud with storage-client
+// This is needed for ZB which is not supported by gcloud storage cp command yet.
+func testdataUploadFilesToBucket(ctx context.Context, t *testing.T, storageClient *storage.Client, bucketNameWithDirPath, dirWith12KFiles, filesPrefix string) {
+	t.Helper()
+
+	bucketName, dirPathInBucket := splitBucketNameAndDirPath(t, bucketNameWithDirPath)
+
+	dirWith12KFilesFullPathPrefix := filepath.Join(dirWith12KFiles, filesPrefix)
+	matches, err := filepath.Glob(dirWith12KFilesFullPathPrefix + "*")
+	if err != nil {
+		t.Fatalf("Failed to get files of pattern %s*: %v", dirWith12KFilesFullPathPrefix, err)
+	}
+
+	type copyRequest struct {
+		srcLocalFilePath string
+		dstGCSObjectPath string
+	}
+	channel := make(chan copyRequest)
+
+	// Copy request producer.
+	go func() {
+		for _, match := range matches {
+			_, fileName := filepath.Split(match)
+			if len(fileName) > 0 {
+				req := copyRequest{srcLocalFilePath: match, dstGCSObjectPath: filepath.Join(dirPathInBucket, fileName)}
+				channel <- req
+			}
+		}
+		// close the channel to let the go-routines know that there is no more object to be copied.
+		close(channel)
+	}()
+
+	// Copy request consumers.
+	numCopyGoroutines := 16
+	var wg sync.WaitGroup
+	for copyGoroutine := 0; copyGoroutine < numCopyGoroutines; copyGoroutine++ {
path: tools/integration_tests/list_large_dir/list_dir_with_twelve_thousand_files_test.go
user: login: gargnitingoogle
body: done
created_at: 2025-04-09T19:18:57Z
author_association: CONTRIBUTOR

PR comments:
user: login: codecov[bot]
created_at: 2025-04-08T04:45:19Z
body: ## [Codecov](https://app.codecov.io/gh/GoogleCloudPlatform/gcsfuse/pull/3155?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 78.28%. Comparing base [(`3df6c32`)](https://app.codecov.io/gh/GoogleCloudPlatform/gcsfuse/commit/3df6c324bc80c04005c32383f60404ee4b8c4aa3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform) to head [(`bb3d34c`)](https://app.codecov.io/gh/GoogleCloudPlatform/gcsfuse/commit/bb3d34c20a40da2fc7554971e31fc7c73745283b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform).
> Report is 1 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #3155      +/-   ##
==========================================
- Coverage   78.39%   78.28%   -0.11%     
==========================================
  Files         124      124              
  Lines       17196    17196              
==========================================
- Hits        13480    13462      -18     
- Misses       3270     3284      +14     
- Partials      446      450       +4     
```

| [Flag](https://app.codecov.io/gh/GoogleCloudPlatform/gcsfuse/pull/3155/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform) | Coverage Δ | |
|---|---|---|
| [unittests](https://app.codecov.io/gh/GoogleCloudPlatform/gcsfuse/pull/3155/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform) | `78.28% <ø> (-0.11%)` | :arrow_down: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform#carryforward-flags-in-the-pull-request-comment) to find out more.

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/GoogleCloudPlatform/gcsfuse/pull/3155?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleCloudPlatform).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
author_association: NONE
user: login: gargnitingoogle
created_at: 2025-04-09T19:19:29Z
body: @kislaykishore I addressed your nit comments. Could you approve again ?
author_association: CONTRIBUTOR