|
13 | 13 | import com.comet.opik.api.resources.utils.TestUtils; |
14 | 14 | import com.comet.opik.api.resources.utils.WireMockUtils; |
15 | 15 | import com.comet.opik.api.resources.utils.resources.OptimizationResourceClient; |
| 16 | +import com.comet.opik.api.resources.v1.jobs.OptimizationStalledReaperJob; |
16 | 17 | import com.comet.opik.extensions.DropwizardAppExtensionProvider; |
17 | 18 | import com.comet.opik.extensions.RegisterApp; |
18 | 19 | import com.comet.opik.podam.PodamFactoryUtils; |
19 | 20 | import com.google.common.eventbus.EventBus; |
| 21 | +import com.google.inject.Injector; |
20 | 22 | import com.redis.testcontainers.RedisContainer; |
21 | 23 | import org.apache.commons.lang3.RandomStringUtils; |
22 | 24 | import org.junit.jupiter.api.BeforeAll; |
@@ -120,18 +122,29 @@ class OptimizationStalledReaperServiceTest { |
120 | 122 |
|
121 | 123 | private OptimizationResourceClient optimizationResourceClient; |
122 | 124 | private OptimizationService optimizationService; |
| 125 | + private Injector injector; |
123 | 126 |
|
124 | 127 | @BeforeAll |
125 | | - void beforeAll(ClientSupport client, OptimizationService optimizationService) { |
| 128 | + void beforeAll(ClientSupport client, OptimizationService optimizationService, Injector injector) { |
126 | 129 | var baseURI = TestUtils.getBaseUrl(client); |
127 | 130 | ClientSupportUtils.config(client); |
128 | 131 |
|
129 | 132 | this.optimizationResourceClient = new OptimizationResourceClient(client, baseURI, podamFactory); |
130 | 133 | this.optimizationService = optimizationService; |
| 134 | + this.injector = injector; |
131 | 135 |
|
132 | 136 | mockTargetWorkspace(wireMock.server(), API_KEY, TEST_WORKSPACE_NAME, WORKSPACE_ID, USER); |
133 | 137 | } |
134 | 138 |
|
| 139 | + @Test |
| 140 | + @DisplayName("reaper job is constructible via Guice (@Config qualifier wiring)") |
| 141 | + void reaperJobIsInjectableFromGuice() { |
| 142 | + // The reaper is disabled/unscheduled in config-test.yml, but the bean is still bound — so this |
| 143 | + // proves the explicit @Inject constructor + @Config("optimizationStalledReaper") qualifier wire |
| 144 | + // correctly at boot (the Quartz/Guice fragility the explicit-ctor change guards against). |
| 145 | + assertThat(injector.getInstance(OptimizationStalledReaperJob.class)).isNotNull(); |
| 146 | + } |
| 147 | + |
135 | 148 | static Stream<Arguments> stalledRuns() { |
136 | 149 | return Stream.of( |
137 | 150 | // INITIALIZED matched by the initialized branch (running timeout kept long so only the |
|
0 commit comments