Repository navigation
Commit 937cf6c
authored
test(services): isolate test app-data state (#95)
## Description
Fixes #48.
Some Go tests inherited the developer's PAIR app-data directory. A saved
LM Studio port file could affect a later run, and a test could overwrite
the developer's saved port.
`develop` replaced `services/lmstudio-proxy` and `services/ollama-proxy`
with `services/nvpair-proxy`, so this branch now merges `develop` and
ports the change to the unified proxy:
- `services/tests` sets a private configuration root for every child
binary it starts. A new test starts a real `nvpair-proxy`, enables the
LM Studio facade, sends `lmstudio:set-port`, and checks that the port
file is written below that root.
- The `nvpair-proxy` end-to-end failover test redirects the
configuration root before it starts its child process.
Both set the variables after `go build`. On Linux and macOS, Go derives
its module and build caches from `HOME`, so redirecting it earlier would
build into the test directory.
## Release intent
<!-- pair-release-intent:v1 -->
### Changelog title
n/a
### Changelog body
n/a
### Bumps
- services: none
- nvpair-cluster-manager: none
- nvpair-engine-manager: none
- nvpair-errors: none
- nvpair-job-scheduler: none
- nvpair-manual-nodes: none
- nvpair-node-info: none
- nvpair-node-scanner: none
- nvpair-node-settings: none
- nvpair-proxy: none
- nvpair-tui: none
- nvpair-ui-broker: none
- nvpair-workload-manager: none
<!-- /pair-release-intent:v1 -->
## Scope
Included:
- Test setup in `services/tests/main_test.go` and
`services/nvpair-proxy/e2e_test.go`.
- One cross-process regression test for LM Studio port persistence.
Excluded:
- Production app-directory behavior, flags, dependencies, APIs,
documentation, and version files.
- The earlier `nvpair-ui-broker` test file.
`services/nvpair-ui-broker/testmain_test.go` on `develop` already
isolates that package, and a second `TestMain` would not compile. The
merge removes it.
## Validation
- `go test . -run TestE2EFailoverOverRealBinary -count=2` in
`services/nvpair-proxy` passed on Windows 11 with Go 1.26.5.
- `go test . -run TestLMStudioFacadeChildPersistsUnderPrivateBase
-count=2` in `services/tests` passed on the same machine.
- `go test . -count=1` passed in `services/nvpair-proxy` and in
`services/tests`. The only skips were the opt-in CORS tests and
`TestBrokerShutsDownOnSignal`.
- The real `%LOCALAPPDATA%\Nvidia Corporation\Personal AI Router`
directory did not exist before these runs and did not exist after them.
- On Linux (golang:1.26 container, non-root user), both focused tests
passed twice and the full `nvpair-proxy` package passed. With the
variable loop removed, the new test fails with "outside test config
base".
- `node scripts/spdx-headers.mjs`, `git diff --check`, and
`scripts/release-intent/validate_pr.py` on this description passed.
## Risk
This change affects test setup only. Compiled binaries and normal PAIR
configuration resolution are unchanged.
## Checklist
- [x] I have read the [Contributing
Guidelines](https://github.com/NVIDIA/Personal-AI-Router/blob/main/CONTRIBUTING.md).
- [x] Every commit is signed off (`git commit -s`), certifying the
[Developer Certificate of Origin](https://developercertificate.org/).
- [x] New or existing tests cover the change.
- [x] Relevant documentation is updated. No documentation change is
needed because users see no behavior change.
- [x] I checked the diff, changed filenames, and commit messages for
credentials, private data, internal URLs, internal issue identifiers,
and generated artifacts.
- [x] I recorded the validation commands and results above.
- [x] I declared version bumps in the release-intent block above.
`services/versions.json` is written by automation — do not edit it by
hand.
---------
Signed-off-by: Som Tripathi <somtri@iastate.edu>1 parent be5e4fb commit 937cf6c
2 files changed
Lines changed: 123 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
282 | 287 | | |
283 | 288 | | |
284 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| |||
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
138 | 155 | | |
139 | 156 | | |
140 | 157 | | |
| |||
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
0 commit comments