test(integration): integrate shared chunk cache tests#4895
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates the shared_chunk_cache package into the end-to-end integration tests, updates the test configuration, and switches the cleanup logic to use the configured test bucket (testEnv.cfg.TestBucket) instead of the default helper. Additionally, it updates the flag parsing logic to split on commas instead of whitespace. Feedback was provided to make this flag parsing more robust by trimming whitespace and filtering out empty strings to prevent potential test failures from malformed flag strings.
| primaryFlags := strings.Split(flagStr, ",") | ||
| var secondaryFlags []string | ||
| if len(cfg.SecondaryFlags) > i { | ||
| secondaryFlags = strings.Fields(cfg.SecondaryFlags[i]) | ||
| secondaryFlags = strings.Split(cfg.SecondaryFlags[i], ",") | ||
| } |
There was a problem hiding this comment.
Using strings.Split directly can lead to empty or whitespace-only strings in the flags slice if the config contains consecutive, leading, or trailing commas, or spaces around commas (e.g., "--flag1, ,--flag2"). This can cause unexpected test failures. A more robust approach is to trim whitespace from each part and filter out any empty strings.
var primaryFlags []string
for _, f := range strings.Split(flagStr, ",") {
if flag := strings.TrimSpace(f); flag != "" {
primaryFlags = append(primaryFlags, flag)
}
}
var secondaryFlags []string
if len(cfg.SecondaryFlags) > i {
secondaryFlags = []string{}
for _, f := range strings.Split(cfg.SecondaryFlags[i], ",") {
if flag := strings.TrimSpace(f); flag != "" {
secondaryFlags = append(secondaryFlags, flag)
}
}
}
Description
This PR integrates the shared chunk cache tests into the integration test suite and updates the test configurations. Specifically, it includes the following changes:
"shared_chunk_cache"toTEST_PACKAGES_COMMONintools/integration_tests/improved_run_e2e_tests.sh.shared_chunk_cachetests to usetestEnv.cfg.TestBucketinstead ofsetup.TestBucket().shared_chunk_cache_test.goto use comma-separated values (strings.Split) instead of spaces (strings.Fields).shared_chunk_cachetest block totools/integration_tests/test_config.yamlto runTestSharedChunkCacheTestSuitewith the relevant experimental shared chunk cache flags on GKE. Note that this configuration was removed in an earlier PR (#4836), assuming it to be present in thetest_config.yaml.Link to the issue in case of a bug fix.
b/535670081
Testing details
Any backward incompatible change? If so, please explain.
No.