File tree 2 files changed +6
-12
lines changed
2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
- import random
15
- import string
14
+ import uuid
16
15
17
16
from google .cloud import spanner
18
17
import pytest
22
21
23
22
def unique_instance_id ():
24
23
""" Creates a unique id for the database. """
25
- return 'test-instance-{}' .format ('' .join (random .choice (
26
- string .ascii_lowercase + string .digits ) for _ in range (5 )))
24
+ return f'test-instance-{ uuid .uuid4 ().hex [:10 ]} '
27
25
28
26
29
27
def unique_database_id ():
30
28
""" Creates a unique id for the database. """
31
- return 'test-db-{}' .format ('' .join (random .choice (
32
- string .ascii_lowercase + string .digits ) for _ in range (5 )))
29
+ return f'test-db-{ uuid .uuid4 ().hex [:10 ]} '
33
30
34
31
35
32
def unique_backup_id ():
36
33
""" Creates a unique id for the backup. """
37
- return 'test-backup-{}' .format ('' .join (random .choice (
38
- string .ascii_lowercase + string .digits ) for _ in range (5 )))
34
+ return f'test-backup-{ uuid .uuid4 ().hex [:10 ]} '
39
35
40
36
41
37
INSTANCE_ID = unique_instance_id ()
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
import os
16
- import random
17
- import string
18
16
import time
17
+ import uuid
19
18
20
19
from google .cloud import spanner
21
20
import pytest
25
24
26
25
def unique_database_id ():
27
26
""" Creates a unique id for the database. """
28
- return 'test-db-{}' .format ('' .join (random .choice (
29
- string .ascii_lowercase + string .digits ) for _ in range (5 )))
27
+ return f'test-db-{ uuid .uuid4 ().hex [:10 ]} '
30
28
31
29
32
30
INSTANCE_ID = os .environ ['SPANNER_INSTANCE' ]
You can’t perform that action at this time.
0 commit comments