diff --git a/misk-clustering/api/misk-clustering.api b/misk-clustering/api/misk-clustering.api index b7b481b8240..3e1e4dcb6c9 100644 --- a/misk-clustering/api/misk-clustering.api +++ b/misk-clustering/api/misk-clustering.api @@ -223,7 +223,7 @@ public abstract interface class misk/clustering/weights/ClusterWeightProvider { public abstract interface class misk/clustering/weights/ClusterWeightService : com/google/common/util/concurrent/Service { } -public final class misk/clustering/weights/FakeClusterWeight : misk/clustering/weights/ClusterWeightProvider { +public final class misk/clustering/weights/FakeClusterWeight : misk/testing/FakeFixture, misk/clustering/weights/ClusterWeightProvider { public fun ()V public fun get ()I public final fun setClusterWeight (I)V diff --git a/misk-clustering/build.gradle.kts b/misk-clustering/build.gradle.kts index 9c6af54f222..f63108cd750 100644 --- a/misk-clustering/build.gradle.kts +++ b/misk-clustering/build.gradle.kts @@ -22,7 +22,7 @@ dependencies { implementation(project(":misk-backoff")) implementation(project(":misk-lease")) implementation(project(":misk-service")) - implementation(project(":misk-testing-api")) + api(project(":misk-testing-api")) testImplementation(libs.assertj) testImplementation(libs.junitApi) diff --git a/misk-clustering/src/main/kotlin/misk/clustering/weights/FakeClusterWeight.kt b/misk-clustering/src/main/kotlin/misk/clustering/weights/FakeClusterWeight.kt index 2711c2fce7c..0d450695eb9 100644 --- a/misk-clustering/src/main/kotlin/misk/clustering/weights/FakeClusterWeight.kt +++ b/misk-clustering/src/main/kotlin/misk/clustering/weights/FakeClusterWeight.kt @@ -1,13 +1,15 @@ package misk.clustering.weights import misk.inject.KAbstractModule +import misk.testing.FakeFixture +import misk.testing.TestFixture /** * A [ClusterWeightProvider] for testing */ -class FakeClusterWeight : ClusterWeightProvider { +class FakeClusterWeight : ClusterWeightProvider, FakeFixture() { - private var weight = 100 + private var weight by resettable { 100 } override fun get(): Int { return weight @@ -25,6 +27,7 @@ class FakeClusterWeightModule : KAbstractModule() { override fun configure() { val fake = FakeClusterWeight() bind().toInstance(fake) + multibind().to() bind().toInstance(fake) install(NoOpClusterWeightServiceModule()) }