Skip to content

Commit

Permalink
Fix tags regex, update test sleeps (#307)
Browse files Browse the repository at this point in the history
* Fix tags regex, update test sleeps

* Update test sleeps
  • Loading branch information
etspaceman authored Apr 18, 2022
1 parent 72f66f7 commit 60671ce
Show file tree
Hide file tree
Showing 30 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions src/fun/scala/kinesis/mock/AwsFunctionalTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ trait AwsFunctionalTests extends CatsEffectSuite with CatsEffectFunFixtures {
.toIO
_ <- resources.logger.debug(s"Created stream ${resources.streamName}")
_ <- IO.sleep(
resources.cacheConfig.createStreamDuration.plus(200.millis)
resources.cacheConfig.createStreamDuration.plus(400.millis)
)
_ <- resources.logger.debug(
s"Describing stream summary for ${resources.streamName}"
Expand Down Expand Up @@ -163,7 +163,7 @@ trait AwsFunctionalTests extends CatsEffectSuite with CatsEffectFunFixtures {
.toIO
_ <- resources.logger.debug(s"Deleted stream ${resources.streamName}")
_ <- IO.sleep(
resources.cacheConfig.deleteStreamDuration.plus(200.millis)
resources.cacheConfig.deleteStreamDuration.plus(400.millis)
)
_ <- resources.logger.debug(
s"Describing stream summary for ${resources.streamName}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DeregisterStreamConsumerTests extends AwsFunctionalTests {
)
.toIO
_ <- IO.sleep(
resources.cacheConfig.registerStreamConsumerDuration.plus(200.millis)
resources.cacheConfig.registerStreamConsumerDuration.plus(400.millis)
)
_ <- resources.kinesisClient
.deregisterStreamConsumer(
Expand All @@ -39,7 +39,7 @@ class DeregisterStreamConsumerTests extends AwsFunctionalTests {
.toIO
check1 <- describeStreamConsumer(resources, consumerName, streamArn)
_ <- IO.sleep(
resources.cacheConfig.deregisterStreamConsumerDuration.plus(200.millis)
resources.cacheConfig.deregisterStreamConsumerDuration.plus(400.millis)
)
check2 <- describeStreamConsumer(
resources,
Expand Down
2 changes: 1 addition & 1 deletion src/fun/scala/kinesis/mock/ListShardsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ListShardsTests extends AwsFunctionalTests {
)
.toIO
_ <- IO.sleep(
resources.cacheConfig.updateShardCountDuration.plus(200.millis)
resources.cacheConfig.updateShardCountDuration.plus(400.millis)
)
res <- resources.kinesisClient
.listShards(
Expand Down
4 changes: 2 additions & 2 deletions src/fun/scala/kinesis/mock/MergeShardsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MergeShardsTests extends AwsFunctionalTests {
)
.toIO
_ <- IO.sleep(
resources.cacheConfig.updateShardCountDuration.plus(200.millis)
resources.cacheConfig.updateShardCountDuration.plus(400.millis)
)
openShards <- resources.kinesisClient
.listShards(
Expand All @@ -49,7 +49,7 @@ class MergeShardsTests extends AwsFunctionalTests {
.build()
)
.toIO
_ <- IO.sleep(resources.cacheConfig.mergeShardsDuration.plus(200.millis))
_ <- IO.sleep(resources.cacheConfig.mergeShardsDuration.plus(400.millis))
openShards2 <- resources.kinesisClient
.listShards(
ListShardsRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RegisterStreamConsumerTests extends AwsFunctionalTests {
.toIO
check1 <- describeStreamConsumer(resources, consumerName, streamArn)
_ <- IO.sleep(
resources.cacheConfig.registerStreamConsumerDuration.plus(200.millis)
resources.cacheConfig.registerStreamConsumerDuration.plus(400.millis)
)
check2 <- describeStreamConsumer(
resources,
Expand Down
2 changes: 1 addition & 1 deletion src/fun/scala/kinesis/mock/SplitShardTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SplitShardTests extends AwsFunctionalTests {
.build()
)
.toIO
_ <- IO.sleep(resources.cacheConfig.splitShardDuration.plus(200.millis))
_ <- IO.sleep(resources.cacheConfig.splitShardDuration.plus(400.millis))
openShards <- resources.kinesisClient
.listShards(
ListShardsRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StartStreamEncryptionTests extends AwsFunctionalTests {
)
.toIO
_ <- IO.sleep(
resources.cacheConfig.startStreamEncryptionDuration.plus(200.millis)
resources.cacheConfig.startStreamEncryptionDuration.plus(400.millis)
)
res <- describeStreamSummary(resources)
} yield assert(
Expand Down
4 changes: 2 additions & 2 deletions src/fun/scala/kinesis/mock/StopStreamEncryptionTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StopStreamEncryptionTests extends AwsFunctionalTests {
)
.toIO
_ <- IO.sleep(
resources.cacheConfig.startStreamEncryptionDuration.plus(200.millis)
resources.cacheConfig.startStreamEncryptionDuration.plus(400.millis)
)
_ <- resources.kinesisClient
.stopStreamEncryption(
Expand All @@ -38,7 +38,7 @@ class StopStreamEncryptionTests extends AwsFunctionalTests {
)
.toIO
_ <- IO.sleep(
resources.cacheConfig.stopStreamEncryptionDuration.plus(200.millis)
resources.cacheConfig.stopStreamEncryptionDuration.plus(400.millis)
)
res <- describeStreamSummary(resources)
} yield assert(
Expand Down
2 changes: 1 addition & 1 deletion src/fun/scala/kinesis/mock/UpdateShardCountTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UpdateShardCountTests extends AwsFunctionalTests {
)
.toIO
_ <- IO.sleep(
resources.cacheConfig.updateShardCountDuration.plus(200.millis)
resources.cacheConfig.updateShardCountDuration.plus(400.millis)
)
openShards <- resources.kinesisClient
.listShards(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final case class AddTagsToStreamRequest(
else Right(())
}, {
val invalidValues = tags.tags.values.filterNot(x =>
x.matches("^([\\p{L}\\p{Z}\\p{N}_./=+\\-%@]*)$")
x.matches("^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$")
)
if (invalidValues.nonEmpty)
InvalidArgumentException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ object CommonValidations {
else Right(())
}, {
val invalidKeyCharacters =
keys.filterNot(x => x.matches("^([\\p{L}\\p{Z}\\p{N}_./=+\\-%@]*)$"))
keys.filterNot(x => x.matches("^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"))
if (invalidKeyCharacters.nonEmpty)
InvalidArgumentException(
s"Keys contain invalid characters. Invalid keys: ${invalidKeyCharacters.mkString(", ")}"
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/kinesis/mock/cache/CreateStreamTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CreateStreamTests
false,
Some(awsRegion)
)
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
checkStream2 <- cache.describeStreamSummary(
describeStreamSummaryReq,
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DecreaseStreamRetentionPeriodTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
_ <- cache
.increaseStreamRetention(
IncreaseStreamRetentionPeriodRequest(48, streamName),
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/kinesis/mock/cache/DeleteStreamTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DeleteStreamTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
res <- cache
.deleteStream(
DeleteStreamRequest(streamName, None),
Expand All @@ -53,7 +53,7 @@ class DeleteStreamTests
false,
Some(awsRegion)
)
_ <- IO.sleep(cacheConfig.deleteStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.deleteStreamDuration.plus(400.millis))
checkStream2 <- cache.describeStreamSummary(
describeStreamSummaryReq,
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DeregisterStreamConsumerTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
_ <- cache
.registerStreamConsumer(
RegisterStreamConsumerRequest(consumerName, streamArn),
Expand All @@ -48,7 +48,7 @@ class DeregisterStreamConsumerTests
)
.rethrow
_ <- IO.sleep(
cacheConfig.registerStreamConsumerDuration.plus(200.millis)
cacheConfig.registerStreamConsumerDuration.plus(400.millis)
)
_ <- cache
.deregisterStreamConsumer(
Expand All @@ -74,7 +74,7 @@ class DeregisterStreamConsumerTests
)
.rethrow
_ <- IO.sleep(
cacheConfig.deregisterStreamConsumerDuration.plus(200.millis)
cacheConfig.deregisterStreamConsumerDuration.plus(400.millis)
)
checkStream2 <- cache.describeStreamConsumer(
describeStreamConsumerReq,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DescribeStreamConsumerTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
registerRes <- cache
.registerStreamConsumer(
RegisterStreamConsumerRequest(
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/kinesis/mock/cache/GetRecordsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GetRecordsTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
recordRequests <- IO(
putRecordRequestArb.arbitrary
.take(5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class GetShardIteratorTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
shard <- cache
.listShards(
ListShardsRequest(None, None, None, None, None, Some(streamName)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class IncreaseStreamRetentionPeriodTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
_ <- cache
.increaseStreamRetention(
IncreaseStreamRetentionPeriodRequest(48, streamName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ListStreamConsumersTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
streamArn <- cache
.describeStreamSummary(
DescribeStreamSummaryRequest(streamName),
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/kinesis/mock/cache/MergeShardsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MergeShardsTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
adjacentParentShardId = ShardId.create(1).shardId
parentShardId = ShardId.create(0).shardId
_ <- cache
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/kinesis/mock/cache/PersistenceTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PersistenceTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
recordRequests <- IO(
putRecordRequestArb.arbitrary
.take(5)
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/kinesis/mock/cache/PutRecordTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PutRecordTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
recordRequests <- IO(
putRecordRequestArb.arbitrary
.take(5)
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/kinesis/mock/cache/PutRecordsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PutRecordsTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
req <- IO(
PutRecordsRequest(
putRecordsRequestEntryArb.arbitrary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RegisterStreamConsumerTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
_ <- cache
.registerStreamConsumer(
RegisterStreamConsumerRequest(consumerName, streamArn),
Expand All @@ -60,7 +60,7 @@ class RegisterStreamConsumerTests
)
.rethrow
_ <- IO.sleep(
cacheConfig.registerStreamConsumerDuration.plus(200.millis)
cacheConfig.registerStreamConsumerDuration.plus(400.millis)
)
checkStream2 <- cache
.describeStreamConsumer(
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/kinesis/mock/cache/SplitShardTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SplitShardTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
listShardsReq = ListShardsRequest(
None,
None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class StartStreamEncryptionTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
keyId <- IO(keyIdGen.one)
_ <- cache
.startStreamEncryption(
Expand All @@ -57,7 +57,7 @@ class StartStreamEncryptionTests
.describeStreamSummary(describeReq, context, false, Some(awsRegion))
.rethrow
_ <- IO.sleep(
cacheConfig.startStreamEncryptionDuration.plus(200.millis)
cacheConfig.startStreamEncryptionDuration.plus(400.millis)
)
checkStream2 <- cache
.describeStreamSummary(describeReq, context, false, Some(awsRegion))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class StopStreamEncryptionTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
keyId <- IO(keyIdGen.one)
_ <- cache
.startStreamEncryption(
Expand All @@ -53,7 +53,7 @@ class StopStreamEncryptionTests
)
.rethrow
_ <- IO.sleep(
cacheConfig.startStreamEncryptionDuration.plus(200.millis)
cacheConfig.startStreamEncryptionDuration.plus(400.millis)
)
_ <- cache
.stopStreamEncryption(
Expand All @@ -72,7 +72,7 @@ class StopStreamEncryptionTests
.describeStreamSummary(describeReq, context, false, Some(awsRegion))
.rethrow
_ <- IO.sleep(
cacheConfig.stopStreamEncryptionDuration.plus(200.millis)
cacheConfig.stopStreamEncryptionDuration.plus(400.millis)
)
checkStream2 <- cache
.describeStreamSummary(describeReq, context, false, Some(awsRegion))
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/kinesis/mock/cache/UpdateShardCountTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class UpdateShardCountTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.createStreamDuration.plus(400.millis))
res <- cache
.updateShardCount(
UpdateShardCountRequest(
Expand All @@ -59,7 +59,7 @@ class UpdateShardCountTests
Some(awsRegion)
)
.rethrow
_ <- IO.sleep(cacheConfig.updateShardCountDuration.plus(200.millis))
_ <- IO.sleep(cacheConfig.updateShardCountDuration.plus(400.millis))
checkStream2 <- cache
.describeStreamSummary(
describeStreamSummaryReq,
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/kinesis/mock/instances/arbitrary.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ object arbitrary {
.choose(1, 128)
.flatMap(size =>
Gen
.resize(size, RegexpGen.from("^([a-zA-Z0-9_./=+\\-%@ ]*)$"))
.resize(size, RegexpGen.from("^([a-zA-Z0-9_.:/=+\\-@ ]*)$"))
.suchThat(x => !x.startsWith("aws:") && x.nonEmpty)
)

val tagValueGen: Gen[String] = Gen
.choose(0, 256)
.flatMap(size =>
Gen.resize(size, RegexpGen.from("^([a-zA-Z0-9_./=+\\-%@ ]*)$"))
Gen.resize(size, RegexpGen.from("^([a-zA-Z0-9_.:/=+\\-@ ]*)$"))
)

val tagsGen: Gen[Tags] = Gen
Expand Down

0 comments on commit 60671ce

Please sign in to comment.