Skip to content

test(integration): add --rcu mode to improved_run_e2e_tests.sh - #5288

Draft
PranjalC100 wants to merge 1 commit into
masterfrom
rcu-improved-run-e2e-master
Draft

PranjalC100 wants to merge 1 commit into
masterfrom
rcu-improved-run-e2e-master

Conversation

@PranjalC100

Copy link
Copy Markdown
Member

Description

Adds --rcu to tools/integration_tests/improved_run_e2e_tests.sh. RCU (Rapid Cache Ultra) caches can't be created per run, so this mode runs the e2e packages on a pre-created pool of HNS RCU buckets <prefix>-1..N.

  • --rcu-bucket-prefix: pool prefix, default gcsfuse-e2e-rcu-<VM zone>-bucket.
  • Zone check before the run: every pool bucket needs a running rapid-cache-ultra cache in the VM zone, or outside it with --rcu-different-zone (forwarded to the tests). Without it, a bucket that lost its cache runs silently as plain HNS.
  • Pool lock: a label on <prefix>-1, set with an ifMetagenerationMatch PATCH. A lock older than 12h is stale.
  • Each package leases a bucket. The bucket is emptied (objects, managed folders, leftover HNS folders) before reuse, or dropped from the pool if that fails.
  • Parallelism is capped at 10, the pool size. --rcu is mutually exclusive with --zonal and --test-on-tpc-endpoint.

Link to the issue in case of a bug fix.

NA

Testing details

  1. Manual - A full --rcu run of an earlier version on a europe-west1-b VM passed every package except managed_folders. This version was tested in a sandbox with stubbed gcloud, curl and go: same zone, cross zone with and without the flag, missing, not-running and wrong-type caches, a missing pool, held and stale locks, a package failure, and all 37 RCU packages at parallelism 10. A us-east7-c run on a real VM is pending.
  2. Unit tests - NA
  3. Integration tests - NA

Any backward incompatible change? If so, please explain.

No. It only adds options; the other modes are unchanged.

RCU (Rapid Cache Ultra) caches can't be created per test run, so --rcu
runs the e2e packages on a pre-created pool of HNS RCU buckets
<prefix>-1..N instead of creating a bucket per package.

- --rcu-bucket-prefix picks the pool. It defaults to
  gcsfuse-e2e-rcu-<VM zone>-bucket.
- Before the run, each pool bucket must have a running rapid-cache-ultra
  cache in the VM zone. With --rcu-different-zone (forwarded to the
  tests), the caches must be outside the VM zone instead. Without this
  check, a bucket that lost its cache runs silently as plain HNS.
- A label on <prefix>-1, set with an ifMetagenerationMatch PATCH, locks
  the pool against concurrent runs. A lock older than 12h is stale.
- Each package leases a bucket. The bucket is emptied (objects, managed
  folders, leftover HNS folders) before reuse, and dropped from the pool
  if that fails.
- Parallelism is capped at 10, the pool size. --rcu is mutually
  exclusive with --zonal and --test-on-tpc-endpoint.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for running end-to-end integration tests against pre-created Rapid Cache Ultra (RCU) buckets. It introduces command-line options (--rcu, --rcu-bucket-prefix, and --rcu-different-zone), implements a cross-run locking mechanism using bucket labels to prevent concurrent runs from interfering with shared buckets, and adds logic to safely empty and validate RCU buckets during parallel test execution. The review feedback points out that the check for empty buckets when running gcloud storage rm might fail because the output message can vary (e.g., "No URLs matched" instead of "matched no objects"), and suggests using an explicit if/else structure to handle this case robustly.

# 'gs://bucket/**' targets only the contents; 'gs://bucket' with --recursive would delete the bucket too.
if ! output=$(gcloud storage rm --recursive "gs://${bucket}/**" --project="${PROJECT_ID}" --quiet 2>&1); then
# An already-empty bucket is not an error.
if [[ "$output" != *"matched no objects"* ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The error message returned by gcloud storage rm when no objects match the wildcard is typically No URLs matched (or Did not match any URLs in older gsutil versions), rather than matched no objects. If the bucket is already empty, this check will fail to recognize it as a non-error. Please update the condition to check for both cases. Additionally, please use an explicit if/else structure instead of the && chain to improve readability and adhere to repository standards for shell scripts.

Suggested change
if [[ "$output" != *"matched no objects"* ]]; then
if [[ "$output" == *"matched no objects"* ]] || [[ "$output" == *"No URLs matched"* ]]; then
# Handle success case
:
else
# Handle error case
exit 1
fi
References
  1. In shell scripts, use an explicit if/else structure for fallback logic instead of the && || chain to improve readability and avoid unexpected behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant