Commit b974e21
test(coverage/nats): drive queueprovider/nats to 100% (was 80.4%) (#29)
Adds targeted coverage for every error branch in queueprovider/nats:
* builder() — bad operator seed, opKP.PublicKey() fail, all defaults applied,
UseTLS scheme flip
* SetResolverPusher — nil-arg resets to no-op (previously could nil-deref)
* IssueTenantCredentials — empty ResourceToken validation, SystemAccount
rejection, legacy_open short-circuit when operator seed unset, pusher-error
propagation, every nkeys.* / jwt.* post-create error branch
(createAccount/PublicKey/Seed, createUser/PublicKey/Seed, sign account JWT,
sign user JWT, FormatUserConfig)
* RevokeTenantCredentials — empty keyID no-op, legacy_open no-op, cache-miss
no-op, encode-revocation failure, push-failure propagation
* RevokeWithSeed — empty seed no-op, legacy_open no-op, FromSeed failure,
derived public key failure, encode failure, push-failure propagation
* lookupCachedByPub — non-matching entry continue-scanning branch
* connectionURL — useTLS=true tls:// scheme
* Name — "nats" identifier
* Capabilities — full shape (PerTenantAccounts/SubjectScopedAuth/StreamIso=true,
BasicAuth=false)
* canonicalSubject — auto-derive when Subject empty
Source refactor: 4 package-level test seams (createAccountKP, createUserKP,
formatUserCreds, parseOperatorKP) so unit tests can inject failing
implementations for branches that the real nkeys/jwt libraries never trip in
practice. In production these seams alias the upstream constructors 1:1 —
zero behavior change.
Coverage: 80.4% → 100.0% (all 14 functions in nats.go).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 50b0d98 commit b974e21
3 files changed
Lines changed: 952 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| |||
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
| |||
96 | 107 | | |
97 | 108 | | |
98 | 109 | | |
99 | | - | |
| 110 | + | |
100 | 111 | | |
101 | 112 | | |
102 | 113 | | |
| |||
220 | 231 | | |
221 | 232 | | |
222 | 233 | | |
223 | | - | |
| 234 | + | |
224 | 235 | | |
225 | 236 | | |
226 | 237 | | |
| |||
272 | 283 | | |
273 | 284 | | |
274 | 285 | | |
275 | | - | |
| 286 | + | |
276 | 287 | | |
277 | 288 | | |
278 | 289 | | |
| |||
316 | 327 | | |
317 | 328 | | |
318 | 329 | | |
319 | | - | |
| 330 | + | |
320 | 331 | | |
321 | 332 | | |
322 | 333 | | |
| |||
397 | 408 | | |
398 | 409 | | |
399 | 410 | | |
400 | | - | |
| 411 | + | |
401 | 412 | | |
402 | 413 | | |
403 | 414 | | |
| |||
0 commit comments