-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test refactor #23
base: develop
Are you sure you want to change the base?
Test refactor #23
Conversation
Use AWS SDK's default mode
5fca90f
to
19a250b
Compare
client: KinesisAsyncClient, | ||
streamName: String, | ||
shardCount: Int | ||
) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can we have an explicit return type on this function? It helps elderly developers who don't know how to configure intellisense.
|
||
override val Timeout: FiniteDuration = 3.minutes | ||
|
||
/** Resources which are shared across tests */ | ||
override val resource: Resource[IO, (Region, LocalStackContainer, Sink[IO])] = | ||
override val resource: Resource[IO, (Region, LocalStackContainer, String => KinesisSinkConfig)] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe simpler to make the return type Resource[IO, (Region, LocalStackContainer)]
. And then the spec can call getKinesisSinkConfig
when needed.
.region(region) | ||
.build() | ||
) | ||
def getKinesisClient(endpoint: URI, region: Region): KinesisAsyncClient = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that KinesisAsyncClient
has a close()
method, and we never call it.
I wonder if strictly speaking neither implementation here is correct. If the close()
method is important (I don't know if it is!) then we should manage the client as a resource:
def getKinesisClient(endpoint: URI, region: Region): Resource[IO, KinesisAsyncClient] =
???
val testStream1Name = "test-source-stream-1" | ||
|
||
val kinesisClient = getKinesisClient(localstack.getEndpoint, region) | ||
createAndWaitForKinesisStream(kinesisClient, testStream1Name, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you do something blocking on a thread does not expect to be blocked. To be honest I have no idea how that affects these tests, whether that's a problem or not.
You could avoid the question by dropping this down into the for
block like this:
for {
_ <- IO.blocking{ createAndWaitForKinesisStream(kinesisClient, testStream1Name, 1) }
refProcessed <- Ref[IO].of[List[ReceivedEvents]](Nil)
// etc
9755873
to
5c21c60
Compare
No description provided.