Skip to content

Commit f397878

Browse files
authored
Fix flaky S3 bucket name generation in integration tests (aws#9779)
1 parent f4f66e6 commit f397878

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tests/integration/test_cli.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
import os
14-
import random
1514
import re
1615
import shutil
1716
import signal
@@ -24,6 +23,7 @@
2423
from awscli.testutils import (
2524
BaseS3CLICommand,
2625
aws,
26+
random_bucket_name,
2727
skip_if_windows,
2828
temporary_file,
2929
unittest,
@@ -173,9 +173,7 @@ def test_param_with_file(self):
173173
def test_streaming_output_operation(self):
174174
d = tempfile.mkdtemp()
175175
self.addCleanup(shutil.rmtree, d)
176-
bucket_name = (
177-
'clistream' + str(int(time.time())) + str(random.randint(1, 100))
178-
)
176+
bucket_name = random_bucket_name('clistream')
179177

180178
self.put_object(
181179
bucket=bucket_name, key='foobar', content='foobar contents'
@@ -196,9 +194,7 @@ def test_no_sign_request(self):
196194
env_vars['AWS_ACCESS_KEY_ID'] = 'foo'
197195
env_vars['AWS_SECRET_ACCESS_KEY'] = 'bar'
198196

199-
bucket_name = (
200-
'nosign' + str(int(time.time())) + str(random.randint(1, 100))
201-
)
197+
bucket_name = random_bucket_name('nosign')
202198
self.put_object(
203199
bucket_name,
204200
'foo',
@@ -229,9 +225,7 @@ def test_no_sign_request(self):
229225
def test_no_paginate_arg(self):
230226
d = tempfile.mkdtemp()
231227
self.addCleanup(shutil.rmtree, d)
232-
bucket_name = (
233-
'nopaginate' + str(int(time.time())) + str(random.randint(1, 100))
234-
)
228+
bucket_name = random_bucket_name('nopaginate')
235229

236230
self.put_object(
237231
bucket=bucket_name, key='foobar', content='foobar contents'

0 commit comments

Comments
 (0)