mengw15 opened a new issue, #7557:
URL: https://github.com/apache/texera/issues/7557

   ### Task Summary
   
   `WorkflowCompilingService.scala` 
(`workflow-compiling-service/src/main/scala/org/apache/texera/service/WorkflowCompilingService.scala`)
 is at **0% coverage** — all 37 tracked lines are unhit. 
`WorkflowCompilingServiceRunSpec` exists but only asserts role-annotation 
coverage on the resource classes; it never instantiates the service or calls 
`run()`.
   
   Because the module is small (57 tracked lines in total), this one file 
dominates its flag: **workflow-compiling-service is at 26.3%**, and covering 
`run()` takes it to roughly **91%**.
   
   **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 `WorkflowCompilingServiceRunSpec` to call `run(config, env)` and 
verify:
   
   - `jersey.setUrlPattern("/api/*")`
   - `jersey.register(classOf[HealthCheckResource])`
   - `jersey.register(classOf[WorkflowCompilationResource])` — the compilation 
endpoint
   - the auth stack installed via `AuthFeatures.register(environment)`
   - the request-logging filter added to the application context
   
   ### 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]

Reply via email to