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

   ### Task Summary
   
   The five Dropwizard service entry points are the least-covered files in 
their modules, and none of them has a spec for `initialize()`:
   
   | File | Lines |
   |---|---|
   | `config-service/.../ConfigService.scala` | 36.7% |
   | `access-control-service/.../AccessControlService.scala` | 37.9% |
   | `notebook-migration-service/.../NotebookMigrationService.scala` | 46.9% |
   | `workflow-compiling-service/.../WorkflowCompilingService.scala` | 48.6% |
   | `computing-unit-managing-service/.../ComputingUnitManagingService.scala` | 
53.6% |
   
   `initialize()` is genuinely testable: `new Bootstrap[Configuration](new 
Service)` does only `Jackson.newObjectMapper()` plus a 
`FileConfigurationSourceProvider` -- no port, no DB, no network. 
`TexeraWebApplicationSpec` (merged #7615) and #7561 are the in-repo precedent; 
entry points are not conventionally excluded here.
   
   All five modules already appear in `.github/workflows/build.yml`'s 
per-service matrix with a `jacoco` step, so specs added here really do run in 
CI.
   
   Traps worth knowing, each of which yields a green test that pins nothing:
   
   1. **An assertion can be carried by an accidental exception.** 
`SubstitutingSourceProvider.open()` calls `substitutor.replace(...)` inline, 
and a *strict* substitutor throws `UndefinedEnvironmentVariableException` from 
there. So a test that opens a config containing an unset variable and then 
asserts the literal survived is really pinned by the throw one line earlier -- 
the matcher is never reached. The strictness claim needs its own test, or a 
regression shows up as an unrelated-looking error inside a test named 
"substitute environment variables".
   2. **The credential arguments cannot be pinned here at all.** 
`common/config/src/main/resources/storage.conf:173-178` ships `username == 
password == "postgres"`, and CI's platform matrix authenticates the default 
superuser with that same password. Swapping the last two arguments of 
`SqlServer.initConnection` is therefore undetectable in these modules, in CI as 
well as locally. Only a `common/dao` spec with a purpose-built role where user 
!= password can kill it.
   3. **`main()` must not be touched.** `Application.run(String...)` binds a 
real port, and dropwizard-core 4.0.7's `Application.onFatalError` calls 
`System.exit(1)` -- a failed attempt kills the shared sbt test JVM and takes 
the whole module's suite with it.
   4. **Retrieving the anonymous request-log filter is Jetty-version 
specific.** Under Jetty 11 `FilterHolder.getFilter` returns null before 
`initialize()`, `getInstance()` is protected, and `initialize()` NPEs against a 
mocked context. amber's precedent does not transfer -- amber pins jetty-servlet 
9.4.20 and uses a real wired `Environment`.
   5. **sbt's JUnit XML does not mark ScalaTest cancellations.** They appear as 
ordinary passing `testcase` elements with `skipped=0`, so a spec that silently 
cancels reads as green. Canceled counts must be taken from the console `Tests:` 
line.
   
   ### 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