Skip to content

Commit 851e4a5

Browse files
authored
Fix flaky integration tests from resource name collisions (#4685)
1 parent 641153f commit 851e4a5

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

tests/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,19 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313

14-
import random
15-
import time
1614
import unittest
15+
import uuid
1716
from unittest import mock
1817

1918
from botocore.compat import HAS_CRT
2019

2120

2221
def unique_id(name):
2322
"""
24-
Generate a unique ID that includes the given name,
25-
a timestamp and a random number. This helps when running
26-
integration tests in parallel that must create remote
27-
resources.
23+
Generate a unique ID for integration tests
24+
that create remote resources in parallel.
2825
"""
29-
return f'{name}-{int(time.time())}-{random.randint(0, 10000)}'
26+
return f"{name}-{uuid.uuid4().hex}"
3027

3128

3229
class BaseTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)