Skip to content

Commit

Permalink
Disable MRAP test
Browse files Browse the repository at this point in the history
  • Loading branch information
lauzadis committed Jun 20, 2024
1 parent 936cfaf commit bc9b0f9
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 121 deletions.
25 changes: 15 additions & 10 deletions services/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,21 @@ subprojects {

if (project.name == "s3") {
dependencies {
val enableMrapTestsProp = "aws.sdk.kotlin.e2etest.enableMrapTest"
val services = project.parent?.subprojects

val s3Control = services?.singleOrNull { it.name == "s3control" }
val sts = services?.singleOrNull { it.name == "sts" }

val shouldRunMrapTests = s3Control != null && sts != null
systemProperty("aws.sdk.kotlin.e2etest.enableMrapTest", System.getProperties().getOrDefault(enableMrapTestsProp, shouldRunMrapTests))

implementation(libs.smithy.kotlin.aws.signing.crt)
// FIXME SDK-KT-214 or re-enable after next release
// val services = project.parent?.subprojects
//
// if (services?.any { it.name == "s3control" } == true) {
// implementation(project(":services:s3control"))
// } else {
// implementation("aws.sdk.kotlin:s3control:+")
// }
//
// if (services?.any { it.name == "sts" } == true) {
// implementation(project(":services:sts"))
// } else {
// implementation("aws.sdk.kotlin:sts:+")
// }
// implementation(libs.smithy.kotlin.aws.signing.crt)
}
}

Expand Down
223 changes: 112 additions & 111 deletions services/s3/e2eTest/src/MutliRegionAccessPointTest.kt
Original file line number Diff line number Diff line change
@@ -1,111 +1,112 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.sdk.kotlin.e2etest

import aws.sdk.kotlin.e2etest.S3TestUtils.createMultiRegionAccessPoint
import aws.sdk.kotlin.e2etest.S3TestUtils.deleteBucketAndAllContents
import aws.sdk.kotlin.e2etest.S3TestUtils.deleteMultiRegionAccessPoint
import aws.sdk.kotlin.e2etest.S3TestUtils.getAccountId
import aws.sdk.kotlin.e2etest.S3TestUtils.getMultiRegionAccessPointArn
import aws.sdk.kotlin.e2etest.S3TestUtils.getTestBucket
import aws.sdk.kotlin.e2etest.S3TestUtils.multiRegionAccessPointWasCreated
import aws.sdk.kotlin.services.s3.S3Client
import aws.sdk.kotlin.services.s3.deleteObject
import aws.sdk.kotlin.services.s3.putObject
import aws.sdk.kotlin.services.s3.withConfig
import aws.sdk.kotlin.services.s3control.S3ControlClient
import aws.smithy.kotlin.runtime.auth.awssigning.UnsupportedSigningAlgorithmException
import aws.smithy.kotlin.runtime.auth.awssigning.crt.CrtAwsSigner
import aws.smithy.kotlin.runtime.http.auth.SigV4AsymmetricAuthScheme
import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.condition.EnabledIfSystemProperty
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIfSystemProperty(named = "aws.sdk.kotlin.e2etest.enableMrapTest", matches = "true")
class MutliRegionAccessPointTest {
private val s3West = S3Client { region = "us-west-2" }
private val s3East = s3West.withConfig { region = "us-east-2" }
private val s3SigV4a = s3West.withConfig { authSchemes = listOf(SigV4AsymmetricAuthScheme(CrtAwsSigner)) }
private val s3Control = S3ControlClient { region = "us-west-2" }

private val multiRegionAccessPoint = "aws-sdk-for-kotlin-test-multi-region-access-point"
private val objectKey = "test.txt"

private lateinit var accountId: String
private lateinit var multiRegionAccessPointArn: String
private lateinit var usWestBucket: String
private lateinit var usEastBucket: String

@BeforeAll
private fun setUp(): Unit = runBlocking {
accountId = getAccountId()
usWestBucket = getTestBucket(s3West, "us-west-2", accountId)
usEastBucket = getTestBucket(s3East, "us-east-2", accountId)

createMultiRegionAccessPoint(
s3Control,
multiRegionAccessPoint,
usWestBucket,
usEastBucket,
accountId,
)

multiRegionAccessPointArn =
getMultiRegionAccessPointArn(
s3Control,
multiRegionAccessPoint,
accountId,
)
}

@AfterAll
private fun cleanUp(): Unit = runBlocking {
if (multiRegionAccessPointWasCreated(s3Control, multiRegionAccessPoint, accountId)) {
deleteMultiRegionAccessPoint(s3Control, multiRegionAccessPoint, accountId)
}

deleteBucketAndAllContents(s3West, usWestBucket)
deleteBucketAndAllContents(s3East, usEastBucket)

s3West.close()
s3East.close()
s3SigV4a.close()
s3Control.close()
}

@Test
fun testMultiRegionAccessPointOperation(): Unit = runBlocking {
s3SigV4a.putObject {
bucket = multiRegionAccessPointArn
key = objectKey
}

s3SigV4a.deleteObject {
bucket = multiRegionAccessPointArn
key = objectKey
}
}

@Test
fun testUnsupportedSigningAlgorithm(): Unit = runBlocking {
val ex = assertFailsWith<UnsupportedSigningAlgorithmException> {
s3West.putObject {
bucket = multiRegionAccessPointArn
key = objectKey
}
}

assertEquals(
ex.message,
"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",
)
}
}
// FIXME SDK-KT-214 or re-enable after next release
///*
// * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// * SPDX-License-Identifier: Apache-2.0
// */
//package aws.sdk.kotlin.e2etest
//
//import aws.sdk.kotlin.e2etest.S3TestUtils.createMultiRegionAccessPoint
//import aws.sdk.kotlin.e2etest.S3TestUtils.deleteBucketAndAllContents
//import aws.sdk.kotlin.e2etest.S3TestUtils.deleteMultiRegionAccessPoint
//import aws.sdk.kotlin.e2etest.S3TestUtils.getAccountId
//import aws.sdk.kotlin.e2etest.S3TestUtils.getMultiRegionAccessPointArn
//import aws.sdk.kotlin.e2etest.S3TestUtils.getTestBucket
//import aws.sdk.kotlin.e2etest.S3TestUtils.multiRegionAccessPointWasCreated
//import aws.sdk.kotlin.services.s3.S3Client
//import aws.sdk.kotlin.services.s3.deleteObject
//import aws.sdk.kotlin.services.s3.putObject
//import aws.sdk.kotlin.services.s3.withConfig
//import aws.sdk.kotlin.services.s3control.S3ControlClient
//import aws.smithy.kotlin.runtime.auth.awssigning.UnsupportedSigningAlgorithmException
//import aws.smithy.kotlin.runtime.auth.awssigning.crt.CrtAwsSigner
//import aws.smithy.kotlin.runtime.http.auth.SigV4AsymmetricAuthScheme
//import kotlinx.coroutines.runBlocking
//import org.junit.jupiter.api.AfterAll
//import org.junit.jupiter.api.BeforeAll
//import org.junit.jupiter.api.Disabled
//import org.junit.jupiter.api.TestInstance
//import org.junit.jupiter.api.condition.EnabledIfSystemProperty
//import kotlin.test.Test
//import kotlin.test.assertEquals
//import kotlin.test.assertFailsWith
//
//@TestInstance(TestInstance.Lifecycle.PER_CLASS)
//class MutliRegionAccessPointTest {
// private val s3West = S3Client { region = "us-west-2" }
// private val s3East = s3West.withConfig { region = "us-east-2" }
// private val s3SigV4a = s3West.withConfig { authSchemes = listOf(SigV4AsymmetricAuthScheme(CrtAwsSigner)) }
// private val s3Control = S3ControlClient { region = "us-west-2" }
//
// private val multiRegionAccessPoint = "aws-sdk-for-kotlin-test-multi-region-access-point"
// private val objectKey = "test.txt"
//
// private lateinit var accountId: String
// private lateinit var multiRegionAccessPointArn: String
// private lateinit var usWestBucket: String
// private lateinit var usEastBucket: String
//
// @BeforeAll
// private fun setUp(): Unit = runBlocking {
// accountId = getAccountId()
// usWestBucket = getTestBucket(s3West, "us-west-2", accountId)
// usEastBucket = getTestBucket(s3East, "us-east-2", accountId)
//
// createMultiRegionAccessPoint(
// s3Control,
// multiRegionAccessPoint,
// usWestBucket,
// usEastBucket,
// accountId,
// )
//
// multiRegionAccessPointArn =
// getMultiRegionAccessPointArn(
// s3Control,
// multiRegionAccessPoint,
// accountId,
// )
// }
//
// @AfterAll
// private fun cleanUp(): Unit = runBlocking {
// if (multiRegionAccessPointWasCreated(s3Control, multiRegionAccessPoint, accountId)) {
// deleteMultiRegionAccessPoint(s3Control, multiRegionAccessPoint, accountId)
// }
//
// deleteBucketAndAllContents(s3West, usWestBucket)
// deleteBucketAndAllContents(s3East, usEastBucket)
//
// s3West.close()
// s3East.close()
// s3SigV4a.close()
// s3Control.close()
// }
//
// @Test
// fun testMultiRegionAccessPointOperation(): Unit = runBlocking {
// s3SigV4a.putObject {
// bucket = multiRegionAccessPointArn
// key = objectKey
// }
//
// s3SigV4a.deleteObject {
// bucket = multiRegionAccessPointArn
// key = objectKey
// }
// }
//
// @Test
// fun testUnsupportedSigningAlgorithm(): Unit = runBlocking {
// val ex = assertFailsWith<UnsupportedSigningAlgorithmException> {
// s3West.putObject {
// bucket = multiRegionAccessPointArn
// key = objectKey
// }
// }
//
// assertEquals(
// ex.message,
// "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",
// )
// }
//}

0 comments on commit bc9b0f9

Please sign in to comment.