mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
test: gs: refresh credentials
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -65,7 +65,23 @@ def _should_test_gcp():
|
||||
if not os.path.exists(TestDvc.GCP_CREDS_FILE):
|
||||
return False
|
||||
|
||||
if os.getenv("GCP_CREDS"):
|
||||
creds = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
|
||||
if creds and os.getenv("GCP_CREDS"):
|
||||
if os.path.exists(creds):
|
||||
os.unlink(creds)
|
||||
shutil.copyfile(TestDvc.GCP_CREDS_FILE, creds)
|
||||
try:
|
||||
check_output(
|
||||
[
|
||||
"gcloud",
|
||||
"auth",
|
||||
"activate-service-account",
|
||||
"--key-file",
|
||||
creds,
|
||||
]
|
||||
)
|
||||
except (CalledProcessError, OSError):
|
||||
return False
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
+1
-1
@@ -957,7 +957,7 @@ class TestReproExternalGS(TestReproExternalBase):
|
||||
return "gsutil cp {} {}".format(i, o)
|
||||
|
||||
def write(self, bucket, key, body):
|
||||
client = gc.Client.from_service_account_json(self.GCP_CREDS_FILE)
|
||||
client = gc.Client()
|
||||
bucket = client.bucket(bucket)
|
||||
bucket.blob(key).upload_from_string(body)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user