Skip to content

Commit 13f5070

Browse files
author
Takashi Matsuo
committed
add random string to the resource names
1 parent a9f97d2 commit 13f5070

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

healthcare/api-client/hl7v2/hl7v2_messages_test.py

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

1515
import os
1616
import pytest
17+
import random
18+
import string
1719
import sys
1820
import time
1921

@@ -27,8 +29,14 @@
2729
project_id = os.environ['GOOGLE_CLOUD_PROJECT']
2830
service_account_json = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
2931

30-
dataset_id = 'test_dataset_{}'.format(int(time.time()))
31-
hl7v2_store_id = 'test_hl7v2_store-{}'.format(int(time.time()))
32+
# assume we can access the OS provied raondom source.
33+
random.seed()
34+
dataset_id = 'test_dataset_{}_{}'.format(
35+
int(time.time()),
36+
''.join([random.choice(string.ascii_letters) for n in range(5)]))
37+
hl7v2_store_id = 'test_hl7v2_store-{}-{}'.format(
38+
int(time.time()),
39+
''.join([random.choice(string.ascii_letters) for n in range(5)]))
3240
hl7v2_message_file = 'resources/hl7-sample-ingest.json'
3341
label_key = 'PROCESSED'
3442
label_value = 'TRUE'

healthcare/api-client/hl7v2/hl7v2_stores_test.py

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

1515
import os
1616
import pytest
17+
import random
18+
import string
1719
import sys
1820
import time
1921

@@ -26,8 +28,14 @@
2628
project_id = os.environ['GOOGLE_CLOUD_PROJECT']
2729
service_account_json = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
2830

29-
dataset_id = 'test_dataset_{}'.format(int(time.time()))
30-
hl7v2_store_id = 'test_hl7v2_store-{}'.format(int(time.time()))
31+
# assume we can access the OS provied raondom source.
32+
random.seed()
33+
dataset_id = 'test_dataset_{}_{}'.format(
34+
int(time.time()),
35+
''.join([random.choice(string.ascii_letters) for n in range(5)]))
36+
hl7v2_store_id = 'test_hl7v2_store-{}-{}'.format(
37+
int(time.time()),
38+
''.join([random.choice(string.ascii_letters) for n in range(5)]))
3139

3240

3341
@pytest.fixture(scope='module')

0 commit comments

Comments
 (0)