File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
test/service-test-utils/src/main/java/software/amazon/awssdk/testutils/service Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,12 @@ public static String temporaryBucketName(Class<?> clz) {
65
65
* @return an s3 bucket name
66
66
*/
67
67
public static String temporaryBucketName (String prefix ) {
68
+ String shortenedPrefix = shortenIfNeeded (prefix , 20 );
68
69
String shortenedUserName = shortenIfNeeded (USER_NAME .getStringValue ().orElse ("unknown" ), 7 );
70
+ String epoch = String .valueOf (System .currentTimeMillis ());
71
+
69
72
String bucketName =
70
- lowerCase (prefix ) + "-" + lowerCase (shortenedUserName ) + "-" + RANDOM .nextInt (10000 );
73
+ lowerCase (shortenedPrefix ) + "-" + lowerCase (shortenedUserName ) + "-" + epoch + "-" + RANDOM .nextInt (10000 );
71
74
if (bucketName .length () > 63 ) {
72
75
logger .error (() -> "S3 buckets can only be 63 chars in length, try a shorter prefix" );
73
76
throw new RuntimeException ("S3 buckets can only be 63 chars in length, try a shorter prefix" );
You can’t perform that action at this time.
0 commit comments