Skip to content

Commit

Permalink
Coverage updates (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
etspaceman authored Feb 4, 2023
1 parent 03c251b commit c62da8b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import software.amazon.kinesis.coordinator.WorkerStateChangeListener.WorkerState

import kinesis4cats.kcl.http4s.generated.{Response, ServiceNotReadyError}

// $COVERAGE-OFF$

/** A simple [[https://http4s.org/ Http4s]] service for KCL users. Often times
* users need to deploy their consumers as a part of an orchestration service,
* such as Kubernetes. Those orchestration services typically depend on some
Expand Down Expand Up @@ -129,3 +131,4 @@ object KCLService {
.build
}
}
// $COVERAGE-ON$
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import kinesis4cats.ciris.CirisReader
import kinesis4cats.kcl.localstack.LocalstackKCLConsumer
import kinesis4cats.kcl.logging.instances.show._

// $COVERAGE-OFF$
object TestKCLService extends ResourceApp.Forever {
override def run(args: List[String]): Resource[IO, Unit] = for {
streamName <- CirisReader.read[String](List("test", "stream")).resource[IO]
Expand All @@ -38,3 +39,4 @@ object TestKCLService extends ResourceApp.Forever {
} yield ()

}
// $COVERAGE-ON$
22 changes: 17 additions & 5 deletions kpl-tests/src/it/scala/kinesis4cats/kpl/KPLProducerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,25 @@ abstract class KPLProducerSpec(implicit LE: KPLProducer.LogEncoders)
LocalstackKPLProducer.producerWithStream(streamName, shardCount)
)

fixture("test1", 1).test("It should produce successfully") { producer =>
fixture("test1", 1).test("It should run commands successfully") { producer =>
val testData = Arbitrary.arbitrary[TestData].one
val testDataBB = ByteBuffer.wrap(testData.asJson.noSpaces.getBytes())

producer.put(new UserRecord("test1", "partitionKey", testDataBB)).map {
result =>
assert(result.isSuccessful())
}
for {
_ <- producer
.put(new UserRecord("test1", "partitionKey", testDataBB))
.map { result =>
assert(result.isSuccessful())
}
_ <- producer.put("test1", "partitionKey", None, testDataBB)
_ <- producer.getOutstandingRecordsCount()
_ <- producer.getOldestRecordTimeInMillis()
_ <- producer.getMetrics()
_ <- producer.getMetrics(1)
_ <- producer.getMetrics("foo")
_ <- producer.getMetrics("foo", 1)
_ <- producer.flush("test1")
_ <- producer.flush()
} yield ()
}
}
3 changes: 2 additions & 1 deletion kpl/src/main/scala/kinesis4cats/kpl/KPLProducer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ class KPLProducer[F[_]] private (
stream,
partitionKey,
explicitHashKey.orNull,
data
data,
schema
)
)
)
Expand Down

0 comments on commit c62da8b

Please sign in to comment.