From 6e30318420b45dae5445b7053ff0f30eeae50ae5 Mon Sep 17 00:00:00 2001 From: Alessandra Romero Date: Fri, 10 Oct 2025 16:17:18 -0400 Subject: [PATCH] Fix flaky S3 bucket name generation in integration tests --- tests/integration/test_cli.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index 7707d280ba1b..d3edcd75a9bd 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -14,13 +14,13 @@ import signal import os import tempfile -import random import shutil import botocore.session from awscli.testutils import unittest, aws, BaseS3CLICommand from awscli.testutils import temporary_file from awscli.testutils import skip_if_windows +from awscli.testutils import random_bucket_name from awscli.clidriver import create_clidriver @@ -159,8 +159,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') @@ -179,8 +178,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', content='bar', extra_args={'ACL': 'public-read-write'}) @@ -203,8 +201,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')