Implement multipart tests
Test Workflow / Lint and test library (pull_request) Failing after 1m23s
Details
Test Workflow / Lint and test library (pull_request) Failing after 1m23s
Details
This commit is contained in:
parent
ddcbe28eca
commit
b0b0c0f6c3
|
@ -6,6 +6,7 @@ import org.junit.jupiter.api.*
|
||||||
import org.junit.jupiter.api.Assertions.*
|
import org.junit.jupiter.api.Assertions.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
val bucketName = System.getenv("BACKUP_BUCKET") ?: "teamcity-executors-test-task"
|
val bucketName = System.getenv("BACKUP_BUCKET") ?: "teamcity-executors-test-task"
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ class BackupClientTest {
|
||||||
fun `before each`() =
|
fun `before each`() =
|
||||||
runBlocking {
|
runBlocking {
|
||||||
s3 = S3Client.fromEnvironment {}
|
s3 = S3Client.fromEnvironment {}
|
||||||
backupClient = BackupClient(s3, bucketName)
|
backupClient = BackupClient(s3, bucketName, 1024 * 1024 * 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
|
@ -49,6 +50,26 @@ class BackupClientTest {
|
||||||
Path("_test/README.md").apply { writeText("# This is a test directory structure.") },
|
Path("_test/README.md").apply { writeText("# This is a test directory structure.") },
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
"single large file" to {
|
||||||
|
val bytes = ByteArray(1024 * 1024 * 32)
|
||||||
|
Random.nextBytes(bytes)
|
||||||
|
listOf(
|
||||||
|
Path("_test.txt").apply { writeBytes(bytes) }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
"large directory structure" to {
|
||||||
|
val bytes1 = ByteArray(1024 * 1024 * 32)
|
||||||
|
val bytes2 = ByteArray(1024 * 1024 * 48)
|
||||||
|
listOf(
|
||||||
|
Path("_test").createDirectory(),
|
||||||
|
Path("_test/a.txt").apply { writeBytes(bytes1) },
|
||||||
|
Path("_test/folder").createDirectory(),
|
||||||
|
Path("_test/another-folder").createDirectory(),
|
||||||
|
Path("_test/another-folder/b").apply { writeText("This is file B\n") },
|
||||||
|
Path("_test/another-folder/c.txt").createFile(),
|
||||||
|
Path("_test/README.md").apply { writeBytes(bytes2) },
|
||||||
|
)
|
||||||
|
}
|
||||||
).map { (name, pathsGen) ->
|
).map { (name, pathsGen) ->
|
||||||
DynamicTest.dynamicTest(name) {
|
DynamicTest.dynamicTest(name) {
|
||||||
val paths = pathsGen()
|
val paths = pathsGen()
|
||||||
|
|
Reference in New Issue