From de8823d57addd73c56e853b3cc5e3c1afef035a3 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 21:04:47 +0000 Subject: [PATCH 01/24] add .yaml file from gcsfs --- cloudbuild/zb-system-tests-cloudbuild.yaml | 120 +++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 cloudbuild/zb-system-tests-cloudbuild.yaml diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml new file mode 100644 index 000000000..f3389e3d8 --- /dev/null +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -0,0 +1,120 @@ +substitutions: + _REGION: "us-central1" + _ZONE: "us-central1-a" + _SHORT_BUILD_ID: ${BUILD_ID:0:8} + +steps: + + # Step 3: Create a GCE VM to run the tests. + # The VM is created in the same zone as the buckets to test rapid storage features. + # It's given the 'cloud-platform' scope to allow it to access GCS and other services. + - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" + id: "create-vm" + entrypoint: "gcloud" + args: + - "compute" + - "instances" + - "create" + - "gcsfs-test-vm-${_SHORT_BUILD_ID}" + - "--project=${PROJECT_ID}" + - "--zone=${_ZONE}" + - "--machine-type=e2-medium" + - "--image-family=debian-13" + - "--image-project=debian-cloud" + - "--service-account=${_ZONAL_VM_SERVICE_ACCOUNT}" + - "--scopes=https://www.googleapis.com/auth/cloud-platform" # Full access to project APIs + - "--metadata=enable-oslogin=TRUE" + waitFor: ["-"] + + # Step 4: Run the integration tests inside the newly created VM. + # This step uses 'gcloud compute ssh' to execute a remote script. + - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" + id: "run-tests-on-vm" + entrypoint: "bash" + args: + - "-c" + - | + set -e + # Wait for the VM to be fully initialized and SSH to be ready. + for i in {1..10}; do + if gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="echo VM is ready"; then + break + fi + echo "Waiting for VM to become available... (attempt $$i/10)" + sleep 15 + done + + # Script to be executed on the VM. + # This script installs dependencies, sets environment variables, and runs pytest. + VM_SCRIPT=" + set -e + echo '--- Installing git and cloning repository on VM ---' + sudo apt-get update > /dev/null + sudo apt-get install -y git python3-pip python3-venv fuse fuse3 libfuse2 > /dev/null + + # Clone the repository and checkout the specific commit from the build trigger. + git clone https://github.com/googleapis/python-storage.git + cd gcsfs + git checkout ${COMMIT_SHA} + + + echo '--- Installing Python and dependencies on VM ---' + python3 -m venv env + source env/bin/activate + + pip install --upgrade pip > /dev/null + # Install testing libraries explicitly, as they are not in setup.py + pip install pytest pytest-timeout pytest-subtests pytest-asyncio fusepy google-cloud-storage > /dev/null + pip install -e . > /dev/null + + echo '--- Preparing test environment on VM ---' + export GCSFS_TEST_BUCKET='gcsfs-test-standard-${_SHORT_BUILD_ID}' + export GCSFS_TEST_VERSIONED_BUCKET='gcsfs-test-versioned-${_SHORT_BUILD_ID}' + export GCSFS_ZONAL_TEST_BUCKET='${_GCSFS_ZONAL_TEST_BUCKET}' + + export STORAGE_EMULATOR_HOST=https://storage.googleapis.com + export GCSFS_TEST_PROJECT=${PROJECT_ID} + export GCSFS_TEST_KMS_KEY=projects/${PROJECT_ID}/locations/${_REGION}/keyRings/${_GCSFS_KEY_RING_NAME}/cryptoKeys/${_GCSFS_KEY_NAME} + + echo '--- Running standard tests on VM ---' + pytest -vv -s \ + --log-format='%(asctime)s %(levelname)s %(message)s' \ + --log-date-format='%H:%M:%S' \ + gcsfs/ \ + --deselect gcsfs/tests/test_core.py::test_sign + + echo '--- Running Zonal tests on VM ---' + export GCSFS_EXPERIMENTAL_ZB_HNS_SUPPORT="true" + pytest -vv -s \ + --log-format='%(asctime)s %(levelname)s %(message)s' \ + --log-date-format='%H:%M:%S' \ + gcsfs/tests/test_extended_gcsfs.py + " + + # Execute the script on the VM via SSH. + gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="$$VM_SCRIPT" + waitFor: + - "create-vm" + + # --- Cleanup Steps --- + + # Step 5: Delete the GCE VM. + - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" + id: "delete-vm" + entrypoint: "gcloud" + args: + - "compute" + - "instances" + - "delete" + - "gcsfs-test-vm-${_SHORT_BUILD_ID}" + - "--zone=${_ZONE}" + - "--quiet" + waitFor: + - "run-tests-on-vm" + +timeout: "3600s" # 60 minutes + +options: + logging: CLOUD_LOGGING_ONLY + pool: + name: "projects/${PROJECT_ID}/locations/us-central1/workerPools/cloud-build-worker-pool" \ No newline at end of file From 12b6e47a71a4425fe574695fbe835e171c16a515 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 21:43:29 +0000 Subject: [PATCH 02/24] add test_zonal.py --- cloudbuild/zb-system-tests-cloudbuild.yaml | 16 +++------- tests/system/test_zonal.py | 37 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 tests/system/test_zonal.py diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index f3389e3d8..3387077a5 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -5,7 +5,7 @@ substitutions: steps: - # Step 3: Create a GCE VM to run the tests. + # Step 1 Create a GCE VM to run the tests. # The VM is created in the same zone as the buckets to test rapid storage features. # It's given the 'cloud-platform' scope to allow it to access GCS and other services. - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" @@ -26,7 +26,7 @@ steps: - "--metadata=enable-oslogin=TRUE" waitFor: ["-"] - # Step 4: Run the integration tests inside the newly created VM. + # Step 2: Run the integration tests inside the newly created VM. # This step uses 'gcloud compute ssh' to execute a remote script. - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" id: "run-tests-on-vm" @@ -54,7 +54,7 @@ steps: # Clone the repository and checkout the specific commit from the build trigger. git clone https://github.com/googleapis/python-storage.git - cd gcsfs + cd python-storage git checkout ${COMMIT_SHA} @@ -76,19 +76,11 @@ steps: export GCSFS_TEST_PROJECT=${PROJECT_ID} export GCSFS_TEST_KMS_KEY=projects/${PROJECT_ID}/locations/${_REGION}/keyRings/${_GCSFS_KEY_RING_NAME}/cryptoKeys/${_GCSFS_KEY_NAME} - echo '--- Running standard tests on VM ---' - pytest -vv -s \ - --log-format='%(asctime)s %(levelname)s %(message)s' \ - --log-date-format='%H:%M:%S' \ - gcsfs/ \ - --deselect gcsfs/tests/test_core.py::test_sign - echo '--- Running Zonal tests on VM ---' - export GCSFS_EXPERIMENTAL_ZB_HNS_SUPPORT="true" pytest -vv -s \ --log-format='%(asctime)s %(levelname)s %(message)s' \ --log-date-format='%H:%M:%S' \ - gcsfs/tests/test_extended_gcsfs.py + tests/system/test_zonal.py " # Execute the script on the VM via SSH. diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py new file mode 100644 index 000000000..6bee3d6ad --- /dev/null +++ b/tests/system/test_zonal.py @@ -0,0 +1,37 @@ +from google.cloud.storage._experimental.asyncio.async_grpc_client import AsyncGrpcClient +from google.cloud.storage._experimental.asyncio.async_appendable_object_writer import ( + AsyncAppendableObjectWriter, +) +from google.cloud.storage._experimental.asyncio.async_multi_range_downloader import ( + AsyncMultiRangeDownloader, +) +import uuid +from io import BytesIO + +import pytest + + +@pytest.mark.asyncio +async def test_zonal_create_object_and_read(): + + bucket_name = "gcsfs-cloudbuild-zonal-bucket" + # bucket_name = "chandrasiri-rs" + bytes_to_upload = b"These_are_some_dummy_bytes_for_to_test_zb_with_cloud_build" + object_name = f"chandrasiri-zb-{str(uuid.uuid4())}" + grpc_client = AsyncGrpcClient().grpc_client + writer = AsyncAppendableObjectWriter(grpc_client, bucket_name, object_name) + await writer.open() + await writer.append(bytes_to_upload) + object_metadata = await writer.close(finalize_on_close=True) + assert object_metadata.size == len(bytes_to_upload) + + mrd = AsyncMultiRangeDownloader(grpc_client, bucket_name, object_name) + buffer = BytesIO() + await mrd.open() + await mrd.download_ranges([(0, 0, buffer)]) + await mrd.close() + assert buffer.getvalue() == bytes_to_upload + + +# if __name__ == "__main__": +# asyncio.run(test_zonal_create_object_and_read()) From 83f3fe845036c312fac0842de4306d04647d5801 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 22:03:38 +0000 Subject: [PATCH 03/24] run pytest via nox --- cloudbuild/zb-system-tests-cloudbuild.yaml | 5 +---- noxfile.py | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index 3387077a5..2c4e5094a 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -77,10 +77,7 @@ steps: export GCSFS_TEST_KMS_KEY=projects/${PROJECT_ID}/locations/${_REGION}/keyRings/${_GCSFS_KEY_RING_NAME}/cryptoKeys/${_GCSFS_KEY_NAME} echo '--- Running Zonal tests on VM ---' - pytest -vv -s \ - --log-format='%(asctime)s %(levelname)s %(message)s' \ - --log-date-format='%H:%M:%S' \ - tests/system/test_zonal.py + nox -s system " # Execute the script on the VM via SSH. diff --git a/noxfile.py b/noxfile.py index b89b9d319..a9c3a95b9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -159,10 +159,10 @@ def system(session): if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": session.skip("RUN_SYSTEM_TESTS is set to false, skipping") # Environment check: Only run tests if the environment variable is set. - if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): - session.skip( - "Credentials must be set via environment variable GOOGLE_APPLICATION_CREDENTIALS" - ) + # if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): + # session.skip( + # "Credentials must be set via environment variable GOOGLE_APPLICATION_CREDENTIALS" + # ) # mTLS tests requires pyopenssl. if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "") == "true": session.install("pyopenssl") @@ -182,7 +182,15 @@ def system(session): # 2021-05-06: defer installing 'google-cloud-*' to after this package, # in order to work around Python 2.7 googolapis-common-protos # issue. - session.install("mock", "pytest", "pytest-rerunfailures", "-c", constraints_path) + session.install( + "mock", + "pytest", + "pytest-rerunfailures", + "pytest-cov", + "pytest-asyncio", + "-c", + constraints_path, + ) session.install("-e", ".", "-c", constraints_path) session.install( "google-cloud-testutils", @@ -200,8 +208,8 @@ def system(session): "--quiet", f"--junitxml=system_{session.python}_sponge_log.xml", "--reruns={}".format(rerun_count), - os.path.join("tests", "system"), - os.path.join("tests", "resumable_media", "system"), + os.path.join("tests", "system", "test_zonal.py"), + # os.path.join("tests", "resumable_media", "system"), *session.posargs, ) From f46cae6681af630bb1c602e822cac54ffea5305a Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 22:05:55 +0000 Subject: [PATCH 04/24] remove /dev/null --- cloudbuild/zb-system-tests-cloudbuild.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index 2c4e5094a..a4bb3b339 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -49,8 +49,8 @@ steps: VM_SCRIPT=" set -e echo '--- Installing git and cloning repository on VM ---' - sudo apt-get update > /dev/null - sudo apt-get install -y git python3-pip python3-venv fuse fuse3 libfuse2 > /dev/null + sudo apt-get update + sudo apt-get install -y git python3-pip python3-venv fuse fuse3 libfuse2 # Clone the repository and checkout the specific commit from the build trigger. git clone https://github.com/googleapis/python-storage.git @@ -62,10 +62,10 @@ steps: python3 -m venv env source env/bin/activate - pip install --upgrade pip > /dev/null + pip install --upgrade pip # Install testing libraries explicitly, as they are not in setup.py - pip install pytest pytest-timeout pytest-subtests pytest-asyncio fusepy google-cloud-storage > /dev/null - pip install -e . > /dev/null + pip install pytest pytest-timeout pytest-subtests pytest-asyncio fusepy google-cloud-storage + pip install -e . echo '--- Preparing test environment on VM ---' export GCSFS_TEST_BUCKET='gcsfs-test-standard-${_SHORT_BUILD_ID}' From 11dcae151ca333f88d1486a01a110d916db6e2f7 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 22:17:33 +0000 Subject: [PATCH 05/24] install nox --- cloudbuild/zb-system-tests-cloudbuild.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index a4bb3b339..43c8ed7a3 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -77,6 +77,7 @@ steps: export GCSFS_TEST_KMS_KEY=projects/${PROJECT_ID}/locations/${_REGION}/keyRings/${_GCSFS_KEY_RING_NAME}/cryptoKeys/${_GCSFS_KEY_NAME} echo '--- Running Zonal tests on VM ---' + python3 -m pip install nox nox -s system " From 05a6fd1a6eaf1b347eb83c5d4c5112a84394f7e9 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 22:40:19 +0000 Subject: [PATCH 06/24] delete vm after tests --- cloudbuild/zb-system-tests-cloudbuild.yaml | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index 43c8ed7a3..534120d84 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -26,10 +26,11 @@ steps: - "--metadata=enable-oslogin=TRUE" waitFor: ["-"] - # Step 2: Run the integration tests inside the newly created VM. + # Step 2: Run the integration tests inside the newly created VM and cleanup. # This step uses 'gcloud compute ssh' to execute a remote script. + # The VM is deleted after tests are run, regardless of success. - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" - id: "run-tests-on-vm" + id: "run-tests-and-delete-vm" entrypoint: "bash" args: - "-c" @@ -40,7 +41,7 @@ steps: if gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="echo VM is ready"; then break fi - echo "Waiting for VM to become available... (attempt $$i/10)" + echo "Waiting for VM to become available... (attempt $i/10)" sleep 15 done @@ -82,25 +83,23 @@ steps: " # Execute the script on the VM via SSH. + # Capture the exit code to ensure cleanup happens before the build fails. + set +e gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="$$VM_SCRIPT" + EXIT_CODE=$? + set -e + + echo "--- Deleting GCE VM ---" + gcloud compute instances delete "gcsfs-test-vm-${_SHORT_BUILD_ID}" --zone=${_ZONE} --quiet + + # Exit with the original exit code from the test script. + exit $EXIT_CODE waitFor: - "create-vm" # --- Cleanup Steps --- - # Step 5: Delete the GCE VM. - - name: "gcr.io/google.com/cloudsdktool/cloud-sdk" - id: "delete-vm" - entrypoint: "gcloud" - args: - - "compute" - - "instances" - - "delete" - - "gcsfs-test-vm-${_SHORT_BUILD_ID}" - - "--zone=${_ZONE}" - - "--quiet" - waitFor: - - "run-tests-on-vm" + # The GCE VM is deleted in the step above to ensure cleanup happens even if tests fail. timeout: "3600s" # 60 minutes From 7f93d06e091458f1e7723e80e32945e38f6aaef5 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 22:42:54 +0000 Subject: [PATCH 07/24] remove exit code --- cloudbuild/zb-system-tests-cloudbuild.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index 534120d84..b569ea9ed 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -86,14 +86,14 @@ steps: # Capture the exit code to ensure cleanup happens before the build fails. set +e gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="$$VM_SCRIPT" - EXIT_CODE=$? + # EXIT_CODE=$? set -e echo "--- Deleting GCE VM ---" gcloud compute instances delete "gcsfs-test-vm-${_SHORT_BUILD_ID}" --zone=${_ZONE} --quiet # Exit with the original exit code from the test script. - exit $EXIT_CODE + # exit $$EXIT_CODE waitFor: - "create-vm" From fd095f6cc99c75d175e474d0d0eff36f78615f17 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 22:56:52 +0000 Subject: [PATCH 08/24] install py3.12 --- cloudbuild/zb-system-tests-cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index b569ea9ed..c300437af 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -51,7 +51,7 @@ steps: set -e echo '--- Installing git and cloning repository on VM ---' sudo apt-get update - sudo apt-get install -y git python3-pip python3-venv fuse fuse3 libfuse2 + sudo apt-get install -y git python3.12 python3-pip python3-venv fuse fuse3 libfuse2 # Clone the repository and checkout the specific commit from the build trigger. git clone https://github.com/googleapis/python-storage.git From 700e09f2bb84e424104d48e81d00c097da6069c5 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Thu, 4 Dec 2025 23:07:13 +0000 Subject: [PATCH 09/24] revert back to pytest --- cloudbuild/zb-system-tests-cloudbuild.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index c300437af..fa983d0fc 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -51,7 +51,7 @@ steps: set -e echo '--- Installing git and cloning repository on VM ---' sudo apt-get update - sudo apt-get install -y git python3.12 python3-pip python3-venv fuse fuse3 libfuse2 + sudo apt-get install -y git python3-pip python3-venv fuse fuse3 libfuse2 # Clone the repository and checkout the specific commit from the build trigger. git clone https://github.com/googleapis/python-storage.git @@ -65,7 +65,8 @@ steps: pip install --upgrade pip # Install testing libraries explicitly, as they are not in setup.py - pip install pytest pytest-timeout pytest-subtests pytest-asyncio fusepy google-cloud-storage + pip install pytest pytest-timeout pytest-subtests pytest-asyncio fusepy + pip install google-cloud-testutils google-cloud-kms pip install -e . echo '--- Preparing test environment on VM ---' @@ -78,8 +79,7 @@ steps: export GCSFS_TEST_KMS_KEY=projects/${PROJECT_ID}/locations/${_REGION}/keyRings/${_GCSFS_KEY_RING_NAME}/cryptoKeys/${_GCSFS_KEY_NAME} echo '--- Running Zonal tests on VM ---' - python3 -m pip install nox - nox -s system + pytest -vv -s --log-format='%(asctime)s %(levelname)s %(message)s' --log-date-format='%H:%M:%S' tests/system/test_zonal.py " # Execute the script on the VM via SSH. From f0387768eda894a5a5d6ba99c894190405c30bf4 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 14:00:01 +0000 Subject: [PATCH 10/24] add basic_wrd systest test --- cloudbuild/zb-system-tests-cloudbuild.yaml | 2 +- tests/system/test_zonal.py | 44 +++++++++++++++------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index fa983d0fc..ba4325fc3 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -72,11 +72,11 @@ steps: echo '--- Preparing test environment on VM ---' export GCSFS_TEST_BUCKET='gcsfs-test-standard-${_SHORT_BUILD_ID}' export GCSFS_TEST_VERSIONED_BUCKET='gcsfs-test-versioned-${_SHORT_BUILD_ID}' - export GCSFS_ZONAL_TEST_BUCKET='${_GCSFS_ZONAL_TEST_BUCKET}' export STORAGE_EMULATOR_HOST=https://storage.googleapis.com export GCSFS_TEST_PROJECT=${PROJECT_ID} export GCSFS_TEST_KMS_KEY=projects/${PROJECT_ID}/locations/${_REGION}/keyRings/${_GCSFS_KEY_RING_NAME}/cryptoKeys/${_GCSFS_KEY_NAME} + export ZONAL_BUCKET=${_ZONAL_BUCKET} echo '--- Running Zonal tests on VM ---' pytest -vv -s --log-format='%(asctime)s %(levelname)s %(message)s' --log-date-format='%H:%M:%S' tests/system/test_zonal.py diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 6bee3d6ad..88182b665 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -1,3 +1,13 @@ +# py standard imports +import asyncio +import os +import uuid +from io import BytesIO + +# python additional imports +import pytest + +# current library imports from google.cloud.storage._experimental.asyncio.async_grpc_client import AsyncGrpcClient from google.cloud.storage._experimental.asyncio.async_appendable_object_writer import ( AsyncAppendableObjectWriter, @@ -5,33 +15,41 @@ from google.cloud.storage._experimental.asyncio.async_multi_range_downloader import ( AsyncMultiRangeDownloader, ) -import uuid -from io import BytesIO -import pytest + +# TODO: replace this with a fixture once zonal bucket creation / deletion +# is supported in grpc client or json client client. +_ZONAL_BUCKET = os.getenv("ZONAL_BUCKET", "zb-for-pysdk-system-tests") @pytest.mark.asyncio -async def test_zonal_create_object_and_read(): +async def test_basic_wrd(storage_client, blobs_to_delete): + bytes_to_upload = b"dummy_bytes_to_write_read_and_delete_appendable_object" + object_name = f"test_basic_wrd-{str(uuid.uuid4())}" - bucket_name = "gcsfs-cloudbuild-zonal-bucket" - # bucket_name = "chandrasiri-rs" - bytes_to_upload = b"These_are_some_dummy_bytes_for_to_test_zb_with_cloud_build" - object_name = f"chandrasiri-zb-{str(uuid.uuid4())}" + # Client instantiation; it cannot be part of fixture because. + # grpc_client's event loop and event loop of coroutine running it + # (i.e. this test) must be same. + # Note: + # 1. @pytest.mark.asyncio ensures new event for each test. + # 2. we can keep the same event loop for entire module but that may + # create issues if tests are run in parallel and one test hogs the event + # loop slowing down other tests. grpc_client = AsyncGrpcClient().grpc_client - writer = AsyncAppendableObjectWriter(grpc_client, bucket_name, object_name) + + writer = AsyncAppendableObjectWriter(grpc_client, _ZONAL_BUCKET, object_name) await writer.open() await writer.append(bytes_to_upload) object_metadata = await writer.close(finalize_on_close=True) assert object_metadata.size == len(bytes_to_upload) - mrd = AsyncMultiRangeDownloader(grpc_client, bucket_name, object_name) + mrd = AsyncMultiRangeDownloader(grpc_client, _ZONAL_BUCKET, object_name) buffer = BytesIO() await mrd.open() + # (0, 0) means read the whole object await mrd.download_ranges([(0, 0, buffer)]) await mrd.close() assert buffer.getvalue() == bytes_to_upload - -# if __name__ == "__main__": -# asyncio.run(test_zonal_create_object_and_read()) + # Clean up; use json client(storage_client fixture) to delete. + blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) From ad357b61660d26ba4c5e289f9ecdfde6ff87d75e Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 14:20:37 +0000 Subject: [PATCH 11/24] instantiate json_client inside test --- tests/system/test_zonal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 88182b665..9abcbb7af 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -3,6 +3,7 @@ import os import uuid from io import BytesIO +from google.cloud.storage import Client # python additional imports import pytest @@ -23,7 +24,7 @@ @pytest.mark.asyncio -async def test_basic_wrd(storage_client, blobs_to_delete): +async def test_basic_wrd(blobs_to_delete): bytes_to_upload = b"dummy_bytes_to_write_read_and_delete_appendable_object" object_name = f"test_basic_wrd-{str(uuid.uuid4())}" @@ -52,4 +53,5 @@ async def test_basic_wrd(storage_client, blobs_to_delete): assert buffer.getvalue() == bytes_to_upload # Clean up; use json client(storage_client fixture) to delete. + storage_client = Client() blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) From 88f47722b1dc3d8c7a45993cf1db9c4741e251f9 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 14:28:38 +0000 Subject: [PATCH 12/24] dont use blobs_to_delete --- tests/system/test_zonal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 9abcbb7af..60ca133d1 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -54,4 +54,5 @@ async def test_basic_wrd(blobs_to_delete): # Clean up; use json client(storage_client fixture) to delete. storage_client = Client() - blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) + storage_client.bucket(_ZONAL_BUCKET).blob(object_name).delete() + # blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) From c85ffcd58681329309a9d23e52d7df6270c0cec9 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 14:28:50 +0000 Subject: [PATCH 13/24] exit code based on pytest result --- cloudbuild/zb-system-tests-cloudbuild.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index ba4325fc3..a0e08fdfc 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -86,14 +86,14 @@ steps: # Capture the exit code to ensure cleanup happens before the build fails. set +e gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="$$VM_SCRIPT" - # EXIT_CODE=$? + EXIT_CODE=$? set -e echo "--- Deleting GCE VM ---" gcloud compute instances delete "gcsfs-test-vm-${_SHORT_BUILD_ID}" --zone=${_ZONE} --quiet # Exit with the original exit code from the test script. - # exit $$EXIT_CODE + exit $$EXIT_CODE waitFor: - "create-vm" From eda4342ba5f1700d0c40d9af00dff8b1ee20ad16 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 14:38:49 +0000 Subject: [PATCH 14/24] remove unwanted deps --- cloudbuild/zb-system-tests-cloudbuild.yaml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index a0e08fdfc..e29216666 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -51,7 +51,7 @@ steps: set -e echo '--- Installing git and cloning repository on VM ---' sudo apt-get update - sudo apt-get install -y git python3-pip python3-venv fuse fuse3 libfuse2 + sudo apt-get install -y git python3-pip python3-venv # Clone the repository and checkout the specific commit from the build trigger. git clone https://github.com/googleapis/python-storage.git @@ -63,21 +63,14 @@ steps: python3 -m venv env source env/bin/activate + echo 'Install testing libraries explicitly, as they are not in setup.py' pip install --upgrade pip - # Install testing libraries explicitly, as they are not in setup.py - pip install pytest pytest-timeout pytest-subtests pytest-asyncio fusepy + pip install pytest pytest-timeout pytest-subtests pytest-asyncio pip install google-cloud-testutils google-cloud-kms pip install -e . - echo '--- Preparing test environment on VM ---' - export GCSFS_TEST_BUCKET='gcsfs-test-standard-${_SHORT_BUILD_ID}' - export GCSFS_TEST_VERSIONED_BUCKET='gcsfs-test-versioned-${_SHORT_BUILD_ID}' - - export STORAGE_EMULATOR_HOST=https://storage.googleapis.com - export GCSFS_TEST_PROJECT=${PROJECT_ID} - export GCSFS_TEST_KMS_KEY=projects/${PROJECT_ID}/locations/${_REGION}/keyRings/${_GCSFS_KEY_RING_NAME}/cryptoKeys/${_GCSFS_KEY_NAME} + echo '--- Setting up environment variables on VM ---' export ZONAL_BUCKET=${_ZONAL_BUCKET} - echo '--- Running Zonal tests on VM ---' pytest -vv -s --log-format='%(asctime)s %(levelname)s %(message)s' --log-date-format='%H:%M:%S' tests/system/test_zonal.py " From 97dadd0358e66a4698d000cfa236c6590a02a9f1 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 14:54:16 +0000 Subject: [PATCH 15/24] use blobs_to_delete --- tests/system/test_zonal.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 60ca133d1..8b57b1ec7 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -24,7 +24,7 @@ @pytest.mark.asyncio -async def test_basic_wrd(blobs_to_delete): +async def test_basic_wrd(storage_client, blobs_to_delete): bytes_to_upload = b"dummy_bytes_to_write_read_and_delete_appendable_object" object_name = f"test_basic_wrd-{str(uuid.uuid4())}" @@ -53,6 +53,6 @@ async def test_basic_wrd(blobs_to_delete): assert buffer.getvalue() == bytes_to_upload # Clean up; use json client(storage_client fixture) to delete. - storage_client = Client() - storage_client.bucket(_ZONAL_BUCKET).blob(object_name).delete() - # blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) + # storage_client = Client() + # storage_client.bucket(_ZONAL_BUCKET).blob(object_name).delete() + blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) From 2d35aa4fc01dbdc057acf571c427fa1b830975c5 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 14:59:15 +0000 Subject: [PATCH 16/24] remove unwanted code --- tests/system/test_zonal.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 8b57b1ec7..4c5f1fa2c 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -53,6 +53,4 @@ async def test_basic_wrd(storage_client, blobs_to_delete): assert buffer.getvalue() == bytes_to_upload # Clean up; use json client(storage_client fixture) to delete. - # storage_client = Client() - # storage_client.bucket(_ZONAL_BUCKET).blob(object_name).delete() blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) From 66280ac0f527d70236138e56d00c0c2323179b2d Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 15:02:07 +0000 Subject: [PATCH 17/24] reduce scope to storage only --- cloudbuild/zb-system-tests-cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index e29216666..de5aab50b 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -22,7 +22,7 @@ steps: - "--image-family=debian-13" - "--image-project=debian-cloud" - "--service-account=${_ZONAL_VM_SERVICE_ACCOUNT}" - - "--scopes=https://www.googleapis.com/auth/cloud-platform" # Full access to project APIs + - "--scopes=httpshttps://www.googleapis.com/auth/devstorage.full_control,https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/devstorage.read_write" - "--metadata=enable-oslogin=TRUE" waitFor: ["-"] From b767bcdbb12ed9795f9737934def168e2baebac3 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 15:04:47 +0000 Subject: [PATCH 18/24] fix type in scopes --- cloudbuild/zb-system-tests-cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index de5aab50b..99397accd 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -22,7 +22,7 @@ steps: - "--image-family=debian-13" - "--image-project=debian-cloud" - "--service-account=${_ZONAL_VM_SERVICE_ACCOUNT}" - - "--scopes=httpshttps://www.googleapis.com/auth/devstorage.full_control,https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/devstorage.read_write" + - "--scopes=https://www.googleapis.com/auth/devstorage.full_control,https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/devstorage.read_write" - "--metadata=enable-oslogin=TRUE" waitFor: ["-"] From 94bfd57a8f64ba775de6de8ffb0d88f94f352075 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 15:17:31 +0000 Subject: [PATCH 19/24] separate out shell cmds into a script --- cloudbuild/run_zonal_tests.sh | 26 +++++++++++++++ cloudbuild/zb-system-tests-cloudbuild.yaml | 38 ++-------------------- 2 files changed, 29 insertions(+), 35 deletions(-) create mode 100644 cloudbuild/run_zonal_tests.sh diff --git a/cloudbuild/run_zonal_tests.sh b/cloudbuild/run_zonal_tests.sh new file mode 100644 index 000000000..a5380c9af --- /dev/null +++ b/cloudbuild/run_zonal_tests.sh @@ -0,0 +1,26 @@ + +set -e +echo '--- Installing git and cloning repository on VM ---' +sudo apt-get update +sudo apt-get install -y git python3-pip python3-venv + +# Clone the repository and checkout the specific commit from the build trigger. +git clone https://github.com/googleapis/python-storage.git +cd python-storage +git checkout ${COMMIT_SHA} + + +echo '--- Installing Python and dependencies on VM ---' +python3 -m venv env +source env/bin/activate + +echo 'Install testing libraries explicitly, as they are not in setup.py' +pip install --upgrade pip +pip install pytest pytest-timeout pytest-subtests pytest-asyncio +pip install google-cloud-testutils google-cloud-kms +pip install -e . + +echo '--- Setting up environment variables on VM ---' +export ZONAL_BUCKET=${_ZONAL_BUCKET} +echo '--- Running Zonal tests on VM ---' +pytest -vv -s --log-format='%(asctime)s %(levelname)s %(message)s' --log-date-format='%H:%M:%S' tests/system/test_zonal.py diff --git a/cloudbuild/zb-system-tests-cloudbuild.yaml b/cloudbuild/zb-system-tests-cloudbuild.yaml index 99397accd..be790ebd4 100644 --- a/cloudbuild/zb-system-tests-cloudbuild.yaml +++ b/cloudbuild/zb-system-tests-cloudbuild.yaml @@ -44,41 +44,13 @@ steps: echo "Waiting for VM to become available... (attempt $i/10)" sleep 15 done - - # Script to be executed on the VM. - # This script installs dependencies, sets environment variables, and runs pytest. - VM_SCRIPT=" - set -e - echo '--- Installing git and cloning repository on VM ---' - sudo apt-get update - sudo apt-get install -y git python3-pip python3-venv - - # Clone the repository and checkout the specific commit from the build trigger. - git clone https://github.com/googleapis/python-storage.git - cd python-storage - git checkout ${COMMIT_SHA} - - - echo '--- Installing Python and dependencies on VM ---' - python3 -m venv env - source env/bin/activate - - echo 'Install testing libraries explicitly, as they are not in setup.py' - pip install --upgrade pip - pip install pytest pytest-timeout pytest-subtests pytest-asyncio - pip install google-cloud-testutils google-cloud-kms - pip install -e . - - echo '--- Setting up environment variables on VM ---' - export ZONAL_BUCKET=${_ZONAL_BUCKET} - echo '--- Running Zonal tests on VM ---' - pytest -vv -s --log-format='%(asctime)s %(levelname)s %(message)s' --log-date-format='%H:%M:%S' tests/system/test_zonal.py - " + # copy the script to the VM + gcloud compute scp cloudbuild/run_zonal_tests.sh gcsfs-test-vm-${_SHORT_BUILD_ID}:~ --zone=${_ZONE} --internal-ip # Execute the script on the VM via SSH. # Capture the exit code to ensure cleanup happens before the build fails. set +e - gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="$$VM_SCRIPT" + gcloud compute ssh gcsfs-test-vm-${_SHORT_BUILD_ID} --zone=${_ZONE} --internal-ip --command="COMMIT_SHA=${COMMIT_SHA} _ZONAL_BUCKET=${_ZONAL_BUCKET} bash run_zonal_tests.sh" EXIT_CODE=$? set -e @@ -90,10 +62,6 @@ steps: waitFor: - "create-vm" - # --- Cleanup Steps --- - - # The GCE VM is deleted in the step above to ensure cleanup happens even if tests fail. - timeout: "3600s" # 60 minutes options: From 5d607e27d7cc27565a70e467a071eb5aa4740504 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 15:30:52 +0000 Subject: [PATCH 20/24] add `RUN_ZONAL_SYSTEM_TESTS` env variable to avoid running zonal tests in kokoro --- cloudbuild/run_zonal_tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cloudbuild/run_zonal_tests.sh b/cloudbuild/run_zonal_tests.sh index a5380c9af..f41431540 100644 --- a/cloudbuild/run_zonal_tests.sh +++ b/cloudbuild/run_zonal_tests.sh @@ -22,5 +22,6 @@ pip install -e . echo '--- Setting up environment variables on VM ---' export ZONAL_BUCKET=${_ZONAL_BUCKET} +export RUN_ZONAL_SYSTEM_TESTS=True echo '--- Running Zonal tests on VM ---' pytest -vv -s --log-format='%(asctime)s %(levelname)s %(message)s' --log-date-format='%H:%M:%S' tests/system/test_zonal.py From 5cb93c70c10cafa395e700a279033f88ab010a96 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 15:35:53 +0000 Subject: [PATCH 21/24] skip entire module if RUN_ZONAL_SYSTEM_TESTS is not set or not True --- tests/system/test_zonal.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 4c5f1fa2c..7ede65c60 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -17,6 +17,11 @@ AsyncMultiRangeDownloader, ) +pytestmark = pytest.mark.skipif( + os.getenv("RUN_ZONAL_SYSTEM_TESTS", None) != "True", + reason="Zonal system tests need to be explicitly enabled. This helps scheduling tests in Kokoro and Cloud Build.", +) + # TODO: replace this with a fixture once zonal bucket creation / deletion # is supported in grpc client or json client client. From b7067e944ee4b10bf843710bb0b3a2020b021a9b Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 15:51:24 +0000 Subject: [PATCH 22/24] revert noxfile changes --- noxfile.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/noxfile.py b/noxfile.py index a9c3a95b9..b89b9d319 100644 --- a/noxfile.py +++ b/noxfile.py @@ -159,10 +159,10 @@ def system(session): if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": session.skip("RUN_SYSTEM_TESTS is set to false, skipping") # Environment check: Only run tests if the environment variable is set. - # if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): - # session.skip( - # "Credentials must be set via environment variable GOOGLE_APPLICATION_CREDENTIALS" - # ) + if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): + session.skip( + "Credentials must be set via environment variable GOOGLE_APPLICATION_CREDENTIALS" + ) # mTLS tests requires pyopenssl. if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "") == "true": session.install("pyopenssl") @@ -182,15 +182,7 @@ def system(session): # 2021-05-06: defer installing 'google-cloud-*' to after this package, # in order to work around Python 2.7 googolapis-common-protos # issue. - session.install( - "mock", - "pytest", - "pytest-rerunfailures", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) + session.install("mock", "pytest", "pytest-rerunfailures", "-c", constraints_path) session.install("-e", ".", "-c", constraints_path) session.install( "google-cloud-testutils", @@ -208,8 +200,8 @@ def system(session): "--quiet", f"--junitxml=system_{session.python}_sponge_log.xml", "--reruns={}".format(rerun_count), - os.path.join("tests", "system", "test_zonal.py"), - # os.path.join("tests", "resumable_media", "system"), + os.path.join("tests", "system"), + os.path.join("tests", "resumable_media", "system"), *session.posargs, ) From c2a79c9ba8e73319b396fbe421505aac109b9c84 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 16:01:47 +0000 Subject: [PATCH 23/24] remove unwanted imports --- tests/system/test_zonal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 7ede65c60..5c2044d76 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -1,9 +1,7 @@ # py standard imports -import asyncio import os import uuid from io import BytesIO -from google.cloud.storage import Client # python additional imports import pytest @@ -57,5 +55,5 @@ async def test_basic_wrd(storage_client, blobs_to_delete): await mrd.close() assert buffer.getvalue() == bytes_to_upload - # Clean up; use json client(storage_client fixture) to delete. + # Clean up; use json client (i.e. `storage_client` fixture) to delete. blobs_to_delete.append(storage_client.bucket(_ZONAL_BUCKET).blob(object_name)) From 0caecfaa4a022e07ce8fab42b3485cc49013f6f9 Mon Sep 17 00:00:00 2001 From: Chandra Sirimala Date: Sun, 7 Dec 2025 16:05:49 +0000 Subject: [PATCH 24/24] remove bucket_name from commit --- cloudbuild/run_zonal_tests.sh | 5 ++--- tests/system/test_zonal.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cloudbuild/run_zonal_tests.sh b/cloudbuild/run_zonal_tests.sh index f41431540..ef94e629b 100644 --- a/cloudbuild/run_zonal_tests.sh +++ b/cloudbuild/run_zonal_tests.sh @@ -1,8 +1,7 @@ -set -e +set -euxo pipefail echo '--- Installing git and cloning repository on VM ---' -sudo apt-get update -sudo apt-get install -y git python3-pip python3-venv +sudo apt-get update && sudo apt-get install -y git python3-pip python3-venv # Clone the repository and checkout the specific commit from the build trigger. git clone https://github.com/googleapis/python-storage.git diff --git a/tests/system/test_zonal.py b/tests/system/test_zonal.py index 5c2044d76..909b9ddf1 100644 --- a/tests/system/test_zonal.py +++ b/tests/system/test_zonal.py @@ -16,14 +16,14 @@ ) pytestmark = pytest.mark.skipif( - os.getenv("RUN_ZONAL_SYSTEM_TESTS", None) != "True", + os.getenv("RUN_ZONAL_SYSTEM_TESTS") != "True", reason="Zonal system tests need to be explicitly enabled. This helps scheduling tests in Kokoro and Cloud Build.", ) # TODO: replace this with a fixture once zonal bucket creation / deletion # is supported in grpc client or json client client. -_ZONAL_BUCKET = os.getenv("ZONAL_BUCKET", "zb-for-pysdk-system-tests") +_ZONAL_BUCKET = os.getenv("ZONAL_BUCKET") @pytest.mark.asyncio