Skip to content

Commit c97d531

Browse files
committed
Re-enable MRAP e2e test
1 parent 30b5590 commit c97d531

File tree

3 files changed

+244
-246
lines changed

3 files changed

+244
-246
lines changed

services/build.gradle.kts

+14-15
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,20 @@ subprojects {
9090

9191
if (project.name == "s3") {
9292
dependencies {
93-
// FIXME SDK-KT-214 or re-enable after next release
94-
// val services = project.parent?.subprojects
95-
//
96-
// if (services?.any { it.name == "s3control" } == true) {
97-
// implementation(project(":services:s3control"))
98-
// } else {
99-
// implementation("aws.sdk.kotlin:s3control:+")
100-
// }
101-
//
102-
// if (services?.any { it.name == "sts" } == true) {
103-
// implementation(project(":services:sts"))
104-
// } else {
105-
// implementation("aws.sdk.kotlin:sts:+")
106-
// }
107-
// implementation(libs.smithy.kotlin.aws.signing.crt)
93+
val services = project.parent?.subprojects
94+
95+
if (services?.any { it.name == "s3control" } == true) {
96+
implementation(project(":services:s3control"))
97+
} else {
98+
implementation("aws.sdk.kotlin:s3control:+")
99+
}
100+
101+
if (services?.any { it.name == "sts" } == true) {
102+
implementation(project(":services:sts"))
103+
} else {
104+
implementation("aws.sdk.kotlin:sts:+")
105+
}
106+
implementation(libs.smithy.kotlin.aws.signing.crt)
108107
}
109108
}
110109

services/s3/e2eTest/src/MutliRegionAccessPointTest.kt

+102-108
Original file line numberDiff line numberDiff line change
@@ -4,112 +4,106 @@
44
*/
55
package aws.sdk.kotlin.e2etest
66

7-
class MutliRegionAccessPointTest
7+
import aws.sdk.kotlin.e2etest.S3TestUtils.createMultiRegionAccessPoint
8+
import aws.sdk.kotlin.e2etest.S3TestUtils.deleteBucketAndAllContents
9+
import aws.sdk.kotlin.e2etest.S3TestUtils.deleteMultiRegionAccessPoint
10+
import aws.sdk.kotlin.e2etest.S3TestUtils.getAccountId
11+
import aws.sdk.kotlin.e2etest.S3TestUtils.getMultiRegionAccessPointArn
12+
import aws.sdk.kotlin.e2etest.S3TestUtils.getTestBucket
13+
import aws.sdk.kotlin.e2etest.S3TestUtils.multiRegionAccessPointWasCreated
14+
import aws.sdk.kotlin.services.s3.S3Client
15+
import aws.sdk.kotlin.services.s3.deleteObject
16+
import aws.sdk.kotlin.services.s3.putObject
17+
import aws.sdk.kotlin.services.s3.withConfig
18+
import aws.sdk.kotlin.services.s3control.S3ControlClient
19+
import aws.smithy.kotlin.runtime.auth.awssigning.UnsupportedSigningAlgorithmException
20+
import aws.smithy.kotlin.runtime.auth.awssigning.crt.CrtAwsSigner
21+
import aws.smithy.kotlin.runtime.http.auth.SigV4AsymmetricAuthScheme
22+
import kotlinx.coroutines.runBlocking
23+
import org.junit.jupiter.api.AfterAll
24+
import org.junit.jupiter.api.BeforeAll
25+
import org.junit.jupiter.api.TestInstance
26+
import kotlin.test.Test
27+
import kotlin.test.assertEquals
28+
import kotlin.test.assertFailsWith
829

9-
// FIXME SDK-KT-214 or re-enable after next release
10-
//
11-
// import aws.sdk.kotlin.e2etest.S3TestUtils.createMultiRegionAccessPoint
12-
// import aws.sdk.kotlin.e2etest.S3TestUtils.deleteBucketAndAllContents
13-
// import aws.sdk.kotlin.e2etest.S3TestUtils.deleteMultiRegionAccessPoint
14-
// import aws.sdk.kotlin.e2etest.S3TestUtils.getAccountId
15-
// import aws.sdk.kotlin.e2etest.S3TestUtils.getMultiRegionAccessPointArn
16-
// import aws.sdk.kotlin.e2etest.S3TestUtils.getTestBucket
17-
// import aws.sdk.kotlin.e2etest.S3TestUtils.multiRegionAccessPointWasCreated
18-
// import aws.sdk.kotlin.services.s3.S3Client
19-
// import aws.sdk.kotlin.services.s3.deleteObject
20-
// import aws.sdk.kotlin.services.s3.putObject
21-
// import aws.sdk.kotlin.services.s3.withConfig
22-
// import aws.sdk.kotlin.services.s3control.S3ControlClient
23-
// import aws.smithy.kotlin.runtime.auth.awssigning.UnsupportedSigningAlgorithmException
24-
// import aws.smithy.kotlin.runtime.auth.awssigning.crt.CrtAwsSigner
25-
// import aws.smithy.kotlin.runtime.http.auth.SigV4AsymmetricAuthScheme
26-
// import kotlinx.coroutines.runBlocking
27-
// import org.junit.jupiter.api.AfterAll
28-
// import org.junit.jupiter.api.BeforeAll
29-
// import org.junit.jupiter.api.Disabled
30-
// import org.junit.jupiter.api.TestInstance
31-
// import org.junit.jupiter.api.condition.EnabledIfSystemProperty
32-
// import kotlin.test.Test
33-
// import kotlin.test.assertEquals
34-
// import kotlin.test.assertFailsWith
35-
//
36-
// @TestInstance(TestInstance.Lifecycle.PER_CLASS)
37-
// class MutliRegionAccessPointTest {
38-
// private val s3West = S3Client { region = "us-west-2" }
39-
// private val s3East = s3West.withConfig { region = "us-east-2" }
40-
// private val s3SigV4a = s3West.withConfig { authSchemes = listOf(SigV4AsymmetricAuthScheme(CrtAwsSigner)) }
41-
// private val s3Control = S3ControlClient { region = "us-west-2" }
42-
//
43-
// private val multiRegionAccessPoint = "aws-sdk-for-kotlin-test-multi-region-access-point"
44-
// private val objectKey = "test.txt"
45-
//
46-
// private lateinit var accountId: String
47-
// private lateinit var multiRegionAccessPointArn: String
48-
// private lateinit var usWestBucket: String
49-
// private lateinit var usEastBucket: String
50-
//
51-
// @BeforeAll
52-
// private fun setUp(): Unit = runBlocking {
53-
// accountId = getAccountId()
54-
// usWestBucket = getTestBucket(s3West, "us-west-2", accountId)
55-
// usEastBucket = getTestBucket(s3East, "us-east-2", accountId)
56-
//
57-
// createMultiRegionAccessPoint(
58-
// s3Control,
59-
// multiRegionAccessPoint,
60-
// usWestBucket,
61-
// usEastBucket,
62-
// accountId,
63-
// )
64-
//
65-
// multiRegionAccessPointArn =
66-
// getMultiRegionAccessPointArn(
67-
// s3Control,
68-
// multiRegionAccessPoint,
69-
// accountId,
70-
// )
71-
// }
72-
//
73-
// @AfterAll
74-
// private fun cleanUp(): Unit = runBlocking {
75-
// if (multiRegionAccessPointWasCreated(s3Control, multiRegionAccessPoint, accountId)) {
76-
// deleteMultiRegionAccessPoint(s3Control, multiRegionAccessPoint, accountId)
77-
// }
78-
//
79-
// deleteBucketAndAllContents(s3West, usWestBucket)
80-
// deleteBucketAndAllContents(s3East, usEastBucket)
81-
//
82-
// s3West.close()
83-
// s3East.close()
84-
// s3SigV4a.close()
85-
// s3Control.close()
86-
// }
87-
//
88-
// @Test
89-
// fun testMultiRegionAccessPointOperation(): Unit = runBlocking {
90-
// s3SigV4a.putObject {
91-
// bucket = multiRegionAccessPointArn
92-
// key = objectKey
93-
// }
94-
//
95-
// s3SigV4a.deleteObject {
96-
// bucket = multiRegionAccessPointArn
97-
// key = objectKey
98-
// }
99-
// }
100-
//
101-
// @Test
102-
// fun testUnsupportedSigningAlgorithm(): Unit = runBlocking {
103-
// val ex = assertFailsWith<UnsupportedSigningAlgorithmException> {
104-
// s3West.putObject {
105-
// bucket = multiRegionAccessPointArn
106-
// key = objectKey
107-
// }
108-
// }
109-
//
110-
// assertEquals(
111-
// ex.message,
112-
// "SIGV4A support is not yet implemented for the default signer. For more information on how to enable it with the CRT signer, please refer to: https://a.co/3sf8533",
113-
// )
114-
// }
115-
// }
30+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
31+
class MutliRegionAccessPointTest {
32+
private val s3West = S3Client { region = "us-west-2" }
33+
private val s3East = s3West.withConfig { region = "us-east-2" }
34+
private val s3SigV4a = s3West.withConfig { authSchemes = listOf(SigV4AsymmetricAuthScheme(CrtAwsSigner)) }
35+
private val s3Control = S3ControlClient { region = "us-west-2" }
36+
37+
private val multiRegionAccessPoint = "aws-sdk-for-kotlin-test-multi-region-access-point"
38+
private val objectKey = "test.txt"
39+
40+
private lateinit var accountId: String
41+
private lateinit var multiRegionAccessPointArn: String
42+
private lateinit var usWestBucket: String
43+
private lateinit var usEastBucket: String
44+
45+
@BeforeAll
46+
private fun setUp(): Unit = runBlocking {
47+
accountId = getAccountId()
48+
usWestBucket = getTestBucket(s3West, "us-west-2", accountId)
49+
usEastBucket = getTestBucket(s3East, "us-east-2", accountId)
50+
51+
createMultiRegionAccessPoint(
52+
s3Control,
53+
multiRegionAccessPoint,
54+
usWestBucket,
55+
usEastBucket,
56+
accountId,
57+
)
58+
59+
multiRegionAccessPointArn =
60+
getMultiRegionAccessPointArn(
61+
s3Control,
62+
multiRegionAccessPoint,
63+
accountId,
64+
)
65+
}
66+
67+
@AfterAll
68+
private fun cleanUp(): Unit = runBlocking {
69+
if (multiRegionAccessPointWasCreated(s3Control, multiRegionAccessPoint, accountId)) {
70+
deleteMultiRegionAccessPoint(s3Control, multiRegionAccessPoint, accountId)
71+
}
72+
73+
deleteBucketAndAllContents(s3West, usWestBucket)
74+
deleteBucketAndAllContents(s3East, usEastBucket)
75+
76+
s3West.close()
77+
s3East.close()
78+
s3SigV4a.close()
79+
s3Control.close()
80+
}
81+
82+
@Test
83+
fun testMultiRegionAccessPointOperation(): Unit = runBlocking {
84+
s3SigV4a.putObject {
85+
bucket = multiRegionAccessPointArn
86+
key = objectKey
87+
}
88+
89+
s3SigV4a.deleteObject {
90+
bucket = multiRegionAccessPointArn
91+
key = objectKey
92+
}
93+
}
94+
95+
@Test
96+
fun testUnsupportedSigningAlgorithm(): Unit = runBlocking {
97+
val ex = assertFailsWith<UnsupportedSigningAlgorithmException> {
98+
s3West.putObject {
99+
bucket = multiRegionAccessPointArn
100+
key = objectKey
101+
}
102+
}
103+
104+
assertEquals(
105+
ex.message,
106+
"SIGV4A support is not yet implemented for the default signer. For more information on how to enable it with the CRT signer, please refer to: https://a.co/3sf8533",
107+
)
108+
}
109+
}

0 commit comments

Comments
 (0)