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