From 4f6c4981a79625f7dc667e07fd118781352af720 Mon Sep 17 00:00:00 2001 From: Morgan Du Date: Tue, 1 Mar 2022 12:54:24 -0800 Subject: [PATCH] fix: update system test_model_upload to use BUILD_SPECIFIC_GCP_PROJECT (#1043) Fixes #972, #877 --- tests/system/aiplatform/test_model_upload.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/system/aiplatform/test_model_upload.py b/tests/system/aiplatform/test_model_upload.py index 76fe679021..ecc70b0c36 100644 --- a/tests/system/aiplatform/test_model_upload.py +++ b/tests/system/aiplatform/test_model_upload.py @@ -19,29 +19,28 @@ import pytest -from google import auth as google_auth from google.cloud import aiplatform from google.cloud import storage from tests.system.aiplatform import e2e_base -# TODO(vinnys): Replace with env var `BUILD_SPECIFIC_GCP_PROJECT` once supported -_, _TEST_PROJECT = google_auth.default() -_TEST_LOCATION = "us-central1" _XGBOOST_MODEL_URI = "gs://cloud-samples-data-us-central1/vertex-ai/google-cloud-aiplatform-ci-artifacts/models/iris_xgboost/model.bst" @pytest.mark.usefixtures("delete_staging_bucket") class TestModel(e2e_base.TestEndToEnd): - _temp_prefix = f"{_TEST_PROJECT}-vertex-staging-{_TEST_LOCATION}" + + _temp_prefix = "temp_vertex_sdk_e2e_model_upload_test" def test_upload_and_deploy_xgboost_model(self, shared_state): """Upload XGBoost model from local file and deploy it for prediction. Additionally, update model name, description and labels""" - aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION) + aiplatform.init( + project=e2e_base._PROJECT, location=e2e_base._LOCATION, + ) - storage_client = storage.Client(project=_TEST_PROJECT) + storage_client = storage.Client(project=e2e_base._PROJECT) model_blob = storage.Blob.from_string( uri=_XGBOOST_MODEL_URI, client=storage_client )