Skip to content

Commit 763a90c

Browse files
committed
Merge pull request #1802 from dhermes/limit-cluster-id-names-in-sys-tests
Making sure to limit cluster IDs to 30 chars in system tests.
2 parents f8ddb2a + f13d420 commit 763a90c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

system_tests/bigtable.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636

3737

3838
CENTRAL_1C_ZONE = 'us-central1-c'
39-
CLUSTER_ID = 'gcloud-py' + unique_resource_id('-')
39+
CLUSTER_ID = 'gcloud' + unique_resource_id('-')
40+
CLUSTER_ID = CLUSTER_ID[:30] # Cluster IDs can't exceed 30 chars.
4041
TABLE_ID = 'gcloud-python-test-table'
4142
COLUMN_FAMILY_ID1 = u'col-fam-id1'
4243
COLUMN_FAMILY_ID2 = u'col-fam-id2'
@@ -148,7 +149,8 @@ def test_reload(self):
148149
self.assertEqual(cluster.serve_nodes, Config.CLUSTER.serve_nodes)
149150

150151
def test_create_cluster(self):
151-
cluster_id = '%s-a' % (CLUSTER_ID,)
152+
cluster_id = 'new' + unique_resource_id('-')
153+
cluster_id = cluster_id[:30] # Cluster IDs can't exceed 30 chars.
152154
cluster = Config.CLIENT.cluster(CENTRAL_1C_ZONE, cluster_id)
153155
operation = cluster.create()
154156
# Make sure this cluster gets deleted after the test case.

system_tests/bigtable_happybase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
_FIRST_ELT = operator.itemgetter(0)
3232
_helpers.PROJECT = TESTS_PROJECT
3333
ZONE = 'us-central1-c'
34-
CLUSTER_ID = 'gcloud-py' + unique_resource_id('-')
34+
CLUSTER_ID = 'gcloud' + unique_resource_id('-')
35+
CLUSTER_ID = CLUSTER_ID[:30] # Cluster IDs can't exceed 30 chars.
3536
TABLE_NAME = 'table-name'
3637
ALT_TABLE_NAME = 'other-table'
3738
TTL_FOR_TEST = 3

system_tests/system_test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ def unique_resource_id(delimiter='_'):
6969
if build_id == '':
7070
return '%s%d' % (delimiter, 1000 * time.time())
7171
else:
72-
return '%s%d%s%s' % (delimiter, time.time(),
73-
delimiter, build_id)
72+
return '%s%s%s%d' % (delimiter, build_id,
73+
delimiter, time.time())

0 commit comments

Comments
 (0)