From 76dc8e4064c395df8679ea55cb960ba24d488bc4 Mon Sep 17 00:00:00 2001 From: Alessandra Romero Date: Fri, 10 Oct 2025 16:49:12 -0400 Subject: [PATCH] Fix flaky S3 bucket name generation in integration tests --- tests/integration/test_cli.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index d34dc6ae023a..3fb10e086853 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -11,7 +11,6 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. import os -import random import re import shutil import signal @@ -24,6 +23,7 @@ from awscli.testutils import ( BaseS3CLICommand, aws, + random_bucket_name, skip_if_windows, temporary_file, unittest, @@ -173,9 +173,7 @@ def test_param_with_file(self): def test_streaming_output_operation(self): d = tempfile.mkdtemp() self.addCleanup(shutil.rmtree, d) - bucket_name = ( - 'clistream' + str(int(time.time())) + str(random.randint(1, 100)) - ) + bucket_name = random_bucket_name('clistream') self.put_object( bucket=bucket_name, key='foobar', content='foobar contents' @@ -196,9 +194,7 @@ def test_no_sign_request(self): env_vars['AWS_ACCESS_KEY_ID'] = 'foo' env_vars['AWS_SECRET_ACCESS_KEY'] = 'bar' - bucket_name = ( - 'nosign' + str(int(time.time())) + str(random.randint(1, 100)) - ) + bucket_name = random_bucket_name('nosign') self.put_object( bucket_name, 'foo', @@ -229,9 +225,7 @@ def test_no_sign_request(self): def test_no_paginate_arg(self): d = tempfile.mkdtemp() self.addCleanup(shutil.rmtree, d) - bucket_name = ( - 'nopaginate' + str(int(time.time())) + str(random.randint(1, 100)) - ) + bucket_name = random_bucket_name('nopaginate') self.put_object( bucket=bucket_name, key='foobar', content='foobar contents'