|
18 | 18 | import org.apache.commons.lang3.StringUtils; |
19 | 19 | import org.apache.commons.lang3.SystemUtils; |
20 | 20 | import org.labkey.serverapi.reader.Readers; |
| 21 | +import org.labkey.test.util.CachingSupplier; |
21 | 22 | import org.labkey.test.util.CspLogUtil; |
| 23 | +import org.labkey.test.util.TestDataGenerator; |
22 | 24 | import org.labkey.test.util.TestLogger; |
23 | 25 | import org.labkey.test.util.Version; |
24 | 26 | import org.openqa.selenium.Dimension; |
|
37 | 39 | import java.util.Iterator; |
38 | 40 | import java.util.List; |
39 | 41 | import java.util.Map; |
| 42 | +import java.util.Objects; |
40 | 43 | import java.util.Optional; |
41 | 44 | import java.util.Properties; |
| 45 | +import java.util.Random; |
42 | 46 | import java.util.stream.Collectors; |
43 | 47 | import java.util.stream.Stream; |
44 | 48 |
|
@@ -245,11 +249,29 @@ public static boolean isCloudPipelineEnabled() |
245 | 249 | return getBooleanProperty("use.cloud.pipeline", false); |
246 | 250 | } |
247 | 251 |
|
| 252 | + private static final CachingSupplier<String> defaultBucketName = new CachingSupplier<>(() -> |
| 253 | + TestDataGenerator.randomChoice(Stream.of(getCloudPipelineBucketNameWithSqs(), getCloudPipelineBucketNameWithoutSqs()) |
| 254 | + .filter(Objects::nonNull).toList())); |
| 255 | + /** |
| 256 | + * Get a pipeline bucket name for use with S3 testing. There are two buckets in different regions. This will |
| 257 | + * randomly select one of them (and cache the result). If SQS is required, use |
| 258 | + * {@link #getCloudPipelineBucketNameWithSqs()} |
| 259 | + */ |
248 | 260 | public static String getCloudPipelineBucketName() |
| 261 | + { |
| 262 | + return defaultBucketName.get(); |
| 263 | + } |
| 264 | + |
| 265 | + public static String getCloudPipelineBucketNameWithSqs() |
249 | 266 | { |
250 | 267 | return System.getProperty("cloud.pipeline.bucket"); |
251 | 268 | } |
252 | 269 |
|
| 270 | + public static String getCloudPipelineBucketNameWithoutSqs() |
| 271 | + { |
| 272 | + return System.getProperty("cloud.pipeline.bucket.nosqs"); |
| 273 | + } |
| 274 | + |
253 | 275 | public static Optional<Dimension> getWindowSize() |
254 | 276 | { |
255 | 277 | String dimensionStr = System.getProperty("webtest.window.size", "1280x1024"); |
|
0 commit comments