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

Fix existing local file integration tests for streaming writes flow. #2902

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

meet2mky
Copy link
Collaborator

@meet2mky meet2mky commented Jan 15, 2025

Description

Fixing existing local file tests for streaming writes flow. Mounts with streaming writes enabled do not support read operation and truncate operation (truncate to lower size than current file size).

Link to the issue in case of a bug fix.

b/388722649

Testing details

  1. Manual - Done
  2. Unit tests - NA
  3. Integration tests - NA

@meet2mky meet2mky added the execute-integration-tests Run only integration tests label Jan 15, 2025
@meet2mky meet2mky changed the title Fixing existing local file tests for streaming writes flow. Fix existing local file integration tests for streaming writes flow. Jan 15, 2025
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.09%. Comparing base (6f2e04b) to head (edf443f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2902      +/-   ##
==========================================
- Coverage   76.12%   76.09%   -0.04%     
==========================================
  Files         118      118              
  Lines       16659    16659              
==========================================
- Hits        12681    12676       -5     
- Misses       3440     3444       +4     
- Partials      538      539       +1     
Flag Coverage Δ
unittests 76.09% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@meet2mky meet2mky force-pushed the streaming-writes-local-file-it branch from ce0f34b to 289abe5 Compare January 16, 2025 05:24
@meet2mky meet2mky force-pushed the streaming-writes-local-file-it branch from 289abe5 to 24d0d7e Compare January 16, 2025 05:27
@meet2mky meet2mky marked this pull request as ready for review January 16, 2025 05:40
@meet2mky meet2mky requested review from Tulsishah and a team as code owners January 16, 2025 05:40
@kislaykishore kislaykishore requested review from a team January 16, 2025 05:40
tools/integration_tests/local_file/local_file_test.go Outdated Show resolved Hide resolved
tools/integration_tests/local_file/stat_file_test.go Outdated Show resolved Hide resolved
@@ -103,6 +105,19 @@ func LogFile() string {
return logFile
}

func SetStreamingWritesEnabled(flags []string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to take @ashmeenkaur opinion on how to refactor local_file tests to run for streaming_writes=true scenario.

We have done it this way for streaming_writes package:https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/tools/integration_tests/streaming_writes/default_mount_local_file_test.go

Probably here its too much of work to refactor, lets take a call with Ashmeen

Copy link
Collaborator

@ashmeenkaur ashmeenkaur Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: Thinking a bit more about it, I think it makes sense to create a common suite and run all these tests for local file without streaming files, local file with streaming writes and empty gcs object with streaming writes since there will be considerable overlap in the 3. That way, instead of having if-else statements in the test, we can have separate tests in the respective test suites for scenarios which differ:
eg:

if setup.StreamingWritesEnabled() {
		// First out of order write ensures the existing sequentially written data is uploaded
		// to GCS when streaming writes are enabled.
		ValidateObjectContentsFromGCS(ctx, storageClient, testDirName, FileName1, "string1", t)
	} else {
		ValidateObjectNotFoundErrOnGCS(ctx, storageClient, testDirName, FileName1, t)
	}
	```

@@ -98,7 +98,9 @@ func TestMain(m *testing.M) {
// Not setting config file explicitly with 'create-empty-file: false' as it is default.
flagsSet := [][]string{
{"--implicit-dirs=true", "--rename-dir-limit=3"},
{"--implicit-dirs=false", "--rename-dir-limit=3"}}
{"--implicit-dirs=false", "--rename-dir-limit=3"},
{"--enable-streaming-writes=true", "--write-block-size-mb=2", "--write-max-blocks-per-file=2"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we combine this with implicit-dirs false tests in favor of saving some test execution time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean if we add "--implicit-dirs=false" flag to the mount then it makes the mounting faster because it doesn't have to list recursive directories? Or is there other reason for fast test execution in this case?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I meant instead of having 3 flagsets to run the tests with, we can just have 2 by combining implicit dirs false(default) with streaming writes tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay got it we keep less flagsets combination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execute-integration-tests Run only integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants