Skip to content

Commit d42b020

Browse files
authored
Merge pull request #2288 from dhermes/fix-2263
Stop using a designated tests project ID.
2 parents 6b42be9 + ceb5595 commit d42b020

File tree

14 files changed

+12
-57
lines changed

14 files changed

+12
-57
lines changed

CONTRIBUTING.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ Running System Tests
153153
so you'll need to provide some environment variables to facilitate
154154
authentication to your project:
155155

156-
- ``GOOGLE_CLOUD_TESTS_PROJECT_ID``: Developers Console project ID (e.g.
157-
bamboo-shift-455).
158156
- ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file;
159157
see ``system_tests/app_credentials.json.sample`` as an example. Such a file
160158
can be downloaded directly from the developer's console by clicking
@@ -182,12 +180,12 @@ Running System Tests
182180
$ export CLOUDSDK_PYTHON_SITEPACKAGES=1
183181

184182
# Authenticate the gcloud tool with your account.
185-
$ JSON_CREDENTIALS_FILE="path/to/app_credentials.json"
186-
$ gcloud auth activate-service-account --key-file=$JSON_CREDENTIALS_FILE
183+
$ GOOGLE_APPLICATION_CREDENTIALS="path/to/app_credentials.json"
184+
$ gcloud auth activate-service-account \
185+
> --key-file=${GOOGLE_APPLICATION_CREDENTIALS}
187186

188187
# Create the indexes
189-
$ gcloud preview datastore create-indexes system_tests/data/index.yaml \
190-
> --project=$GOOGLE_CLOUD_TESTS_PROJECT_ID
188+
$ gcloud preview datastore create-indexes system_tests/data/index.yaml
191189

192190
# Restore your environment to its previous state.
193191
$ unset CLOUDSDK_PYTHON_SITEPACKAGES

google/cloud/environment_vars.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
PROJECT = 'GOOGLE_CLOUD_PROJECT'
2222
"""Environment variable defining default project."""
2323

24-
TESTS_PROJECT = 'GOOGLE_CLOUD_TESTS_PROJECT_ID'
25-
"""Environment variable defining project for tests."""
26-
2724
GCD_DATASET = 'DATASTORE_DATASET'
2825
"""Environment variable defining default dataset ID under GCD."""
2926

system_tests/bigquery.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
import unittest
1818

19-
from google.cloud import _helpers
20-
from google.cloud.environment_vars import TESTS_PROJECT
2119
from google.cloud import bigquery
2220
from google.cloud.exceptions import Forbidden
2321

@@ -52,7 +50,6 @@ class Config(object):
5250

5351

5452
def setUpModule():
55-
_helpers.PROJECT = TESTS_PROJECT
5653
Config.CLIENT = bigquery.Client()
5754

5855

system_tests/bigtable.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import unittest
1919

20-
from google.cloud import _helpers
2120
from google.cloud._helpers import _datetime_from_microseconds
2221
from google.cloud._helpers import _microseconds_from_datetime
2322
from google.cloud._helpers import UTC
@@ -29,7 +28,6 @@
2928
from google.cloud.bigtable.row_filters import RowFilterUnion
3029
from google.cloud.bigtable.row_data import Cell
3130
from google.cloud.bigtable.row_data import PartialRowData
32-
from google.cloud.environment_vars import TESTS_PROJECT
3331

3432
from retry import RetryErrors
3533
from retry import RetryResult
@@ -92,7 +90,6 @@ def _retry_on_unavailable(exc):
9290

9391
def setUpModule():
9492
from grpc._channel import _Rendezvous
95-
_helpers.PROJECT = TESTS_PROJECT
9693
Config.CLIENT = Client(admin=True)
9794
Config.INSTANCE = Config.CLIENT.instance(INSTANCE_ID, LOCATION_ID)
9895
retry = RetryErrors(_Rendezvous, error_predicate=_retry_on_unavailable)

system_tests/clear_datastore.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import six
2222

2323
from google.cloud import datastore
24-
from google.cloud.environment_vars import TESTS_PROJECT
2524

2625

2726
FETCH_MAX = 20
@@ -90,7 +89,7 @@ def remove_kind(kind, client):
9089
def remove_all_entities(client=None):
9190
if client is None:
9291
# Get a client that uses the test dataset.
93-
client = datastore.Client(project=os.getenv(TESTS_PROJECT))
92+
client = datastore.Client()
9493
for kind in ALL_KINDS:
9594
remove_kind(kind, client)
9695

system_tests/datastore.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818

1919
import httplib2
2020

21-
from google.cloud import _helpers
2221
from google.cloud._helpers import UTC
2322
from google.cloud import datastore
2423
from google.cloud.datastore.helpers import GeoPoint
2524
from google.cloud.environment_vars import GCD_DATASET
26-
from google.cloud.environment_vars import TESTS_PROJECT
2725
from google.cloud.exceptions import Conflict
2826

2927
import clear_datastore
@@ -55,7 +53,6 @@ def setUpModule():
5553
# Isolated namespace so concurrent test runs don't collide.
5654
test_namespace = 'ns' + unique_resource_id()
5755
if emulator_dataset is None:
58-
_helpers.PROJECT = TESTS_PROJECT
5956
Config.CLIENT = datastore.Client(namespace=test_namespace)
6057
else:
6158
credentials = EmulatorCreds()

system_tests/language.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
import unittest
1616

17-
from google.cloud import _helpers
18-
from google.cloud.environment_vars import TESTS_PROJECT
1917
from google.cloud import exceptions
2018
from google.cloud import language
2119
from google.cloud import storage
@@ -39,7 +37,6 @@ class Config(object):
3937

4038

4139
def setUpModule():
42-
_helpers.PROJECT = TESTS_PROJECT
4340
Config.CLIENT = language.Client()
4441
# Now create a bucket for GCS stored content.
4542
storage_client = storage.Client()
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export GOOGLE_APPLICATION_CREDENTIALS="app_credentials.json.sample"
2-
export GOOGLE_CLOUD_TESTS_PROJECT_ID="my-project"
32
export GOOGLE_CLOUD_REMOTE_FOR_LINT="upstream"
43
export GOOGLE_CLOUD_BRANCH_FOR_LINT="master"

system_tests/logging_.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
from google.cloud.logging.handlers.handlers import CloudLoggingHandler
2121
from google.cloud.logging.handlers.transports import SyncTransport
2222
from google.cloud.logging import client
23-
from google.cloud import _helpers
24-
from google.cloud.environment_vars import TESTS_PROJECT
2523

2624
from retry import RetryErrors
2725
from retry import RetryResult
@@ -52,7 +50,6 @@ class Config(object):
5250

5351

5452
def setUpModule():
55-
_helpers.PROJECT = TESTS_PROJECT
5653
Config.CLIENT = client.Client()
5754

5855

system_tests/monitoring.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
import unittest
1616

17-
from google.cloud import _helpers
18-
from google.cloud.environment_vars import TESTS_PROJECT
1917
from google.cloud.exceptions import InternalServerError
2018
from google.cloud.exceptions import NotFound
2119
from google.cloud.exceptions import ServiceUnavailable
@@ -30,10 +28,6 @@
3028
retry_503 = RetryErrors(ServiceUnavailable)
3129

3230

33-
def setUpModule():
34-
_helpers.PROJECT = TESTS_PROJECT
35-
36-
3731
class TestMonitoring(unittest.TestCase):
3832

3933
def test_fetch_metric_descriptor(self):

0 commit comments

Comments
 (0)