Skip to content

Commit 7c7fd00

Browse files
mogitaclaude
andcommitted
feat: ExternalStorageOperations video integration test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6816909 commit 7c7fd00

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

src/test/java/io/getstream/VideoIntegrationTest.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,75 @@ void testDeactivateUser() throws Exception {
748748
waitForAsyncTask(taskId);
749749
}
750750

751+
@Test
752+
@Order(15)
753+
void testExternalStorageOperations() throws Exception {
754+
String storageName = "test-storage-" + RandomStringUtils.randomAlphabetic(8).toLowerCase();
755+
756+
// Cleanup: delete existing storages if there are too many accumulated over time
757+
try {
758+
var listResp = client.listExternalStorage().execute();
759+
if (listResp.getData() != null
760+
&& listResp.getData().getExternalStorages() != null
761+
&& listResp.getData().getExternalStorages().size() > 1) {
762+
for (String name : listResp.getData().getExternalStorages().keySet()) {
763+
try {
764+
client.deleteExternalStorage(name).execute();
765+
} catch (Exception ignored) {
766+
}
767+
}
768+
}
769+
} catch (Exception ignored) {
770+
}
771+
772+
// Create a new external storage with S3 credentials
773+
var createResp =
774+
client
775+
.createExternalStorage(
776+
CreateExternalStorageRequest.builder()
777+
.bucket("test-bucket")
778+
.name(storageName)
779+
.storageType("s3")
780+
.path("test-directory/")
781+
.awsS3(
782+
S3Request.builder()
783+
.s3Region("us-east-1")
784+
.s3APIKey("test-access-key")
785+
.s3Secret("test-secret")
786+
.build())
787+
.build())
788+
.execute();
789+
assertNotNull(createResp.getData());
790+
791+
try {
792+
// List with retry for eventual consistency (up to 24s, 3s intervals = 8 attempts)
793+
boolean found = false;
794+
for (int i = 0; i < 8; i++) {
795+
Thread.sleep(3000);
796+
var listResp = client.listExternalStorage().execute();
797+
if (listResp.getData() != null
798+
&& listResp.getData().getExternalStorages() != null
799+
&& listResp.getData().getExternalStorages().containsKey(storageName)) {
800+
found = true;
801+
break;
802+
}
803+
}
804+
assertTrue(found, "Created external storage should appear in the list");
805+
} finally {
806+
// Delete with retry (eventual consistency may delay availability for delete)
807+
for (int i = 0; i < 5; i++) {
808+
try {
809+
client.deleteExternalStorage(storageName).execute();
810+
break;
811+
} catch (Exception e) {
812+
if (i < 4) {
813+
Thread.sleep(3000);
814+
}
815+
}
816+
}
817+
}
818+
}
819+
751820
@Test
752821
@Order(14)
753822
void testTeams() throws Exception {

0 commit comments

Comments
 (0)