Merge "Use GOOGLE_APPLICATION_CREDENTIALS instead of SERVICE_ACCOUNT_KEY_PATH"
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index f33d010..5f33214 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -41,11 +41,11 @@
 
 In this case we have to provide an GCP service account key and the instance name
 under which the test refdb will be created. This is done by passing two
-environment variables `SERVICE_ACCOUNT_KEY_PATH` and `SPANNER_INSTANCE`:
+environment variables `GOOGLE_APPLICATION_CREDENTIALS` and `SPANNER_INSTANCE`:
 
 ```
 bazelisk test \
-  --test_env='SERVICE_ACCOUNT_KEY_PATH=/path/to/the/key.json' \
+  --test_env='GOOGLE_APPLICATION_CREDENTIALS=/path/to/the/key.json' \
   --test_env='SPANNER_INSTANCE=test-instance' \
   --test_tag_filters=@PLUGIN@ //...
 ```
@@ -55,7 +55,7 @@
 
 ```
 bazelisk test \
-  --test_env='SERVICE_ACCOUNT_KEY_PATH=/path/to/the/key.json' \
+  --test_env='GOOGLE_APPLICATION_CREDENTIALS=/path/to/the/key.json' \
   --test_env='SPANNER_INSTANCE=test-instance' \
   //plugins/@PLUGIN@/...
 ```
@@ -66,7 +66,7 @@
 the tests. A container running spanner will be created automatically by the
 tests.
 
-The absence of the `SERVICE_ACCOUNT_KEY_PATH` env variable means that the tests
+The absence of the `GOOGLE_APPLICATION_CREDENTIALS` env variable means that the tests
 will create local spanner emulator.
 
 ```
diff --git a/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/RealSpannerRefDb.java b/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/RealSpannerRefDb.java
index 6635ac6..c1693f9 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/RealSpannerRefDb.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/RealSpannerRefDb.java
@@ -37,7 +37,7 @@
 
   public static RealSpannerRefDb create() {
     if (INSTANCE == null) {
-      String keyPath = System.getenv("SERVICE_ACCOUNT_KEY_PATH");
+      String keyPath = System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
       String instance = System.getenv("SPANNER_INSTANCE");
       INSTANCE = new RealSpannerRefDb(keyPath, instance);
     }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/SpannerTestSystem.java b/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/SpannerTestSystem.java
index aff7407..5b2d6e6 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/SpannerTestSystem.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/spannerrefdb/SpannerTestSystem.java
@@ -22,7 +22,7 @@
 
   public static SpannerTestSystem create() throws Exception {
     SpannerTestSystem testSystem;
-    if (System.getenv("SERVICE_ACCOUNT_KEY_PATH") == null) {
+    if (System.getenv("GOOGLE_APPLICATION_CREDENTIALS") == null) {
       testSystem = new EmulatedSpannerRefDb();
     } else {
       testSystem = RealSpannerRefDb.create();