cashapp / misk

Microservice Kontainer

Home Page:https://cashapp.github.io/misk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FakeMetrics breaks with multiple tests

ewolak-sq opened this issue · comments

If I write one test class (annotated with @MiskTest(startService = true)) with an @Inject lateinit var metrics: FakeMetrics field and two @Test methods, the metrics field will get reinitialized between the first and second test but the FakeMetrics injected into my service persists. So then I'm fetching values on metrics and not finding them, because even in the second test they were getting recorded on the first instance of FakeMetrics.

After investigation we blame companion object and not FakeMetrics.

😩