From 2ac4dad5a1a4e51691aec8298e95856eb6eef43c Mon Sep 17 00:00:00 2001 From: Daniel Urban Date: Tue, 14 May 2024 01:47:35 +0200 Subject: [PATCH] Fix test --- .../dev/tauri/choam/profiler/RxnProfilerSpec.scala | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/profiler/src/test/scala/dev/tauri/choam/profiler/RxnProfilerSpec.scala b/profiler/src/test/scala/dev/tauri/choam/profiler/RxnProfilerSpec.scala index fe1b6848..c2b07a84 100644 --- a/profiler/src/test/scala/dev/tauri/choam/profiler/RxnProfilerSpec.scala +++ b/profiler/src/test/scala/dev/tauri/choam/profiler/RxnProfilerSpec.scala @@ -73,7 +73,8 @@ trait RxnProfilerSpec[F[_]] extends CatsEffectSuite with BaseSpecAsyncF[F] { thi this.assume(Consts.statsEnabled) simulateRun { _ => F.unit } { r => for { - _ <- assertEqualsF(r.size, 4) + _ <- assertEqualsF(r.size, 5) + _ <- assertF(r(RxnProfiler.CommitsPerSecond).getScore.isNaN) _ <- assertF(r(RxnProfiler.RetriesPerCommit).getScore.isNaN) _ <- assertEqualsF(r(RxnProfiler.ReusedWeakRefs).getScore, 0.0) _ <- assertEqualsF(r(RxnProfiler.ExchangeCount).getScore, 0.0) @@ -87,34 +88,42 @@ trait RxnProfilerSpec[F[_]] extends CatsEffectSuite with BaseSpecAsyncF[F] { thi this.assume(Consts.statsEnabled) for { _ <- simulateRunConfig("") { _ => F.unit } { r => F.delay { + assert(r.get(RxnProfiler.CommitsPerSecond).isDefined) assert(r.get(RxnProfiler.RetriesPerCommit).isDefined) - assert(r.get(RxnProfiler.ExchangesPerSecond).isDefined) + assert(r.get(RxnProfiler.ReusedWeakRefs).isDefined) + assert(r.get(RxnProfiler.ExchangesPerSecond).isEmpty) assert(r.get(RxnProfiler.ExchangeCount).isEmpty) }} _ <- simulateRunConfig("debug") { _ => F.unit } { r => F.delay { + assert(r.get(RxnProfiler.CommitsPerSecond).isDefined) assert(r.get(RxnProfiler.RetriesPerCommit).isDefined) assert(r.get(RxnProfiler.ReusedWeakRefs).isDefined) assert(r.get(RxnProfiler.ExchangesPerSecond).isDefined) assert(r.get(RxnProfiler.ExchangeCount).isDefined) }} _ <- simulateRunConfig("retries") { _ => F.unit } { r => F.delay { + assert(r.get(RxnProfiler.CommitsPerSecond).isEmpty) assert(r.get(RxnProfiler.RetriesPerCommit).isDefined) + assert(r.get(RxnProfiler.ReusedWeakRefs).isEmpty) assert(r.get(RxnProfiler.ExchangesPerSecond).isEmpty) assert(r.get(RxnProfiler.ExchangeCount).isEmpty) }} _ <- simulateRunConfig("retries;reusedWeakRefs") { _ => F.unit } { r => F.delay { + assert(r.get(RxnProfiler.CommitsPerSecond).isEmpty) assert(r.get(RxnProfiler.RetriesPerCommit).isDefined) assert(r.get(RxnProfiler.ReusedWeakRefs).isDefined) assert(r.get(RxnProfiler.ExchangesPerSecond).isEmpty) assert(r.get(RxnProfiler.ExchangeCount).isEmpty) }} _ <- simulateRunConfig("retries;exchanges") { _ => F.unit } { r => F.delay { + assert(r.get(RxnProfiler.CommitsPerSecond).isEmpty) assert(r.get(RxnProfiler.RetriesPerCommit).isDefined) assert(r.get(RxnProfiler.ReusedWeakRefs).isEmpty) assert(r.get(RxnProfiler.ExchangesPerSecond).isDefined) assert(r.get(RxnProfiler.ExchangeCount).isEmpty) }} _ <- simulateRunConfig("retries;exchangeCount") { _ => F.unit } { r => F.delay { + assert(r.get(RxnProfiler.CommitsPerSecond).isEmpty) assert(r.get(RxnProfiler.RetriesPerCommit).isDefined) assert(r.get(RxnProfiler.ReusedWeakRefs).isEmpty) assert(r.get(RxnProfiler.ExchangesPerSecond).isEmpty)