Skip to content

Commit b084874

Browse files
committed
Configure region
1 parent dadf763 commit b084874

File tree

1 file changed

+51
-47
lines changed

1 file changed

+51
-47
lines changed

services/route53/e2eTest/src/InvalidChangeBatchTest.kt

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,66 @@ import aws.smithy.kotlin.runtime.util.Uuid
99
import kotlinx.coroutines.test.runTest
1010
import kotlin.test.Test
1111
import kotlin.test.assertContains
12-
import kotlin.test.assertNotNull
1312
import kotlin.test.assertFailsWith
13+
import kotlin.test.assertNotNull
1414

1515
// https://github.com/awslabs/aws-sdk-kotlin/issues/1433
1616
class InvalidChangeBatchTest {
1717
@Test
18-
fun testMessageIsPopulated() = runTest { Route53Client {}.use { client ->
19-
val createHostedZoneResp = client.createHostedZone {
20-
this.callerReference = Uuid.random().toString()
21-
this.name = "this-is-a-test-hosted-zone-for-aws-sdk-kotlin.com"
22-
}
18+
fun testMessageIsPopulated() = runTest {
19+
Route53Client {
20+
region = "us-east-1"
21+
}.use { client ->
22+
val createHostedZoneResp = client.createHostedZone {
23+
this.callerReference = Uuid.random().toString()
24+
this.name = "this-is-a-test-hosted-zone-for-aws-sdk-kotlin.com"
25+
}
2326

24-
val hostedZoneId = checkNotNull(createHostedZoneResp.hostedZone?.id) { "Hosted zone is unexpectedly null" }
27+
val hostedZoneId = checkNotNull(createHostedZoneResp.hostedZone?.id) { "Hosted zone is unexpectedly null" }
2528

26-
val exception = assertFailsWith<InvalidChangeBatch> {
27-
client.changeResourceRecordSets {
28-
this.hostedZoneId = hostedZoneId
29-
this.changeBatch = ChangeBatch {
30-
this.changes = listOf(
31-
Change {
32-
this.action = ChangeAction.Delete
33-
this.resourceRecordSet = ResourceRecordSet {
34-
this.name = "test.blerg.com"
35-
this.type = RrType.Cname
36-
this.ttl = 300
37-
this.resourceRecords = listOf(
38-
ResourceRecord {
39-
value = "test.blerg.com"
40-
}
41-
)
42-
}
43-
},
44-
Change {
45-
this.action = ChangeAction.Create
46-
this.resourceRecordSet = ResourceRecordSet {
47-
this.name = "test.blerg.com"
48-
this.type = RrType.Cname
49-
this.ttl = 300
50-
this.resourceRecords = listOf(
51-
ResourceRecord {
52-
value = "test.blerg.com"
53-
}
54-
)
55-
}
56-
},
57-
)
58-
this.comment = "testing..."
29+
val exception = assertFailsWith<InvalidChangeBatch> {
30+
client.changeResourceRecordSets {
31+
this.hostedZoneId = hostedZoneId
32+
this.changeBatch = ChangeBatch {
33+
this.changes = listOf(
34+
Change {
35+
this.action = ChangeAction.Delete
36+
this.resourceRecordSet = ResourceRecordSet {
37+
this.name = "test.blerg.com"
38+
this.type = RrType.Cname
39+
this.ttl = 300
40+
this.resourceRecords = listOf(
41+
ResourceRecord {
42+
value = "test.blerg.com"
43+
},
44+
)
45+
}
46+
},
47+
Change {
48+
this.action = ChangeAction.Create
49+
this.resourceRecordSet = ResourceRecordSet {
50+
this.name = "test.blerg.com"
51+
this.type = RrType.Cname
52+
this.ttl = 300
53+
this.resourceRecords = listOf(
54+
ResourceRecord {
55+
value = "test.blerg.com"
56+
},
57+
)
58+
}
59+
},
60+
)
61+
this.comment = "testing..."
62+
}
5963
}
6064
}
61-
}
6265

63-
client.deleteHostedZone {
64-
id = hostedZoneId
65-
}
66+
client.deleteHostedZone {
67+
id = hostedZoneId
68+
}
6669

67-
assertNotNull(exception.message)
68-
assertContains(exception.message, "[Tried to delete resource record set [name='test.blerg.com.', type='CNAME'] but it was not found, RRSet with DNS name test.blerg.com. is not permitted in zone this-is-a-test-domain-for-aws-sdk-kotlin.com., RRSet of type CNAME with DNS name test.blerg.com. is not permitted as it creates a CNAME loop in the zone.]")
69-
} }
70+
assertNotNull(exception.message)
71+
assertContains(exception.message, "[Tried to delete resource record set [name='test.blerg.com.', type='CNAME'] but it was not found, RRSet with DNS name test.blerg.com. is not permitted in zone this-is-a-test-domain-for-aws-sdk-kotlin.com., RRSet of type CNAME with DNS name test.blerg.com. is not permitted as it creates a CNAME loop in the zone.]")
72+
}
73+
}
7074
}

0 commit comments

Comments
 (0)