File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14- import random
15- import string
14+ import uuid
1615
1716from google .cloud import spanner
1817import pytest
2221
2322def unique_instance_id ():
2423 """ 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 ]} '
2725
2826
2927def unique_database_id ():
3028 """ 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 ]} '
3330
3431
3532def unique_backup_id ():
3633 """ 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 ]} '
3935
4036
4137INSTANCE_ID = unique_instance_id ()
Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515import os
16- import random
17- import string
1816import time
17+ import uuid
1918
2019from google .cloud import spanner
2120import pytest
2524
2625def unique_database_id ():
2726 """ 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 ]} '
3028
3129
3230INSTANCE_ID = os .environ ['SPANNER_INSTANCE' ]
You can’t perform that action at this time.
0 commit comments