Skip to content

Commit 1ef329d

Browse files
authored
Fix flaky S3 bucket name generation in integration tests (aws#9778)
1 parent 47c3b25 commit 1ef329d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/integration/test_cli.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
import signal
1515
import os
1616
import tempfile
17-
import random
1817
import shutil
1918

2019
import botocore.session
2120
from awscli.testutils import unittest, aws, BaseS3CLICommand
2221
from awscli.testutils import temporary_file
2322
from awscli.testutils import skip_if_windows
23+
from awscli.testutils import random_bucket_name
2424
from awscli.clidriver import create_clidriver
2525

2626

@@ -159,8 +159,7 @@ def test_param_with_file(self):
159159
def test_streaming_output_operation(self):
160160
d = tempfile.mkdtemp()
161161
self.addCleanup(shutil.rmtree, d)
162-
bucket_name = 'clistream' + str(
163-
int(time.time())) + str(random.randint(1, 100))
162+
bucket_name = random_bucket_name('clistream')
164163

165164
self.put_object(bucket=bucket_name, key='foobar',
166165
content='foobar contents')
@@ -179,8 +178,7 @@ def test_no_sign_request(self):
179178
env_vars['AWS_ACCESS_KEY_ID'] = 'foo'
180179
env_vars['AWS_SECRET_ACCESS_KEY'] = 'bar'
181180

182-
bucket_name = 'nosign' + str(
183-
int(time.time())) + str(random.randint(1, 100))
181+
bucket_name = random_bucket_name('nosign')
184182
self.put_object(bucket_name, 'foo', content='bar',
185183
extra_args={'ACL': 'public-read-write'})
186184

@@ -203,8 +201,7 @@ def test_no_sign_request(self):
203201
def test_no_paginate_arg(self):
204202
d = tempfile.mkdtemp()
205203
self.addCleanup(shutil.rmtree, d)
206-
bucket_name = 'nopaginate' + str(
207-
int(time.time())) + str(random.randint(1, 100))
204+
bucket_name = random_bucket_name('nopaginate')
208205

209206
self.put_object(bucket=bucket_name, key='foobar',
210207
content='foobar contents')

0 commit comments

Comments
 (0)