mengw15 opened a new issue, #7558:
URL: https://github.com/apache/texera/issues/7558
### Task Summary
`ConfigService.scala`
(`config-service/src/main/scala/org/apache/texera/service/ConfigService.scala`)
is at **0% coverage** — all 30 tracked lines are unhit. `ConfigServiceRunSpec`
exists but only asserts role-annotation coverage on the resource classes; it
never instantiates the service or calls `run()`.
The module is small (97 tracked lines), so this one file dominates its flag:
**config-service is at 66.0%**, and covering `run()` takes it to roughly
**97%**.
**Goal: exercise `run()` against a mocked Dropwizard `Environment` and
assert the wiring it installs**, then check the coverage report for anything
left.
### Pattern to follow
`AccessControlServiceRunSpec` already does exactly this and is the template
(74 lines; mockito is already on the test classpath):
```scala
val jersey = mock(classOf[JerseyEnvironment])
val servlets = mock(classOf[ServletEnvironment])
val context = mock(classOf[MutableServletContextHandler])
val env = mock(classOf[Environment])
when(env.jersey).thenReturn(jersey)
when(env.servlets).thenReturn(servlets)
when(env.getApplicationContext).thenReturn(context)
when(jersey.getResourceConfig).thenReturn(DropwizardResourceConfig.forTesting())
service.run(mock(classOf[XxxConfiguration]), env)
verify(jersey).register(classOf[SomeResource])
```
Keep the existing role-annotation assertions in the spec.
### Behavior to add
Extend `ConfigServiceRunSpec` to call `run(config, env)` and verify:
- `jersey.setUrlPattern("/api/*")`
- `servlets.setSessionHandler(...)` — the session handler is installed
- `jersey.register(classOf[HealthCheckResource])`
- the `ConfigResource` registration
- the auth stack installed via `AuthFeatures.register(environment)`
- `RequestLoggingFilter.register(environment.getApplicationContext)`
### Scope note
Cover **`run()` only**. Do **not** add tests for `initialize()`, `main()`,
or the per-service `configFilePath` / `initConnection` helpers — #5983
(`refactor(service): unify Dropwizard service bootstrap into common/auth`)
moves exactly that boilerplate into a shared `ServiceBootstrap`, so tests
written against it would be discarded. `run()` and its resource registrations
stay put under that refactor (that PR's own description confirms the existing
service specs still pass).
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]