Commit 5660760
committed
Add unit tests with dependency injection
- Refactor CLI commands to support dependency injection via functional options pattern
- Add DrasiClient interface to enable mocking of Management API
- Create testutil package with mock implementations for DrasiClient, PlatformClient, and TaskOutput
- Add comprehensive unit tests covering success/failure paths for all resource management commands
- Fix error handling bugs: commands now properly return errors instead of printing
- Fix output routing: use cmd.OutOrStdout() for testability
- Individual command coverage: list 78.3%, describe 78.6%, apply 84.4%, delete 84.4%
Signed-off-by: Aman Singh <[email protected]>1 parent e71624d commit 5660760
File tree
18 files changed
+1551
-47
lines changed- .github/workflows
- cli
- cmd
- sdk
- testutil
18 files changed
+1551
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| |||
287 | 287 | | |
288 | 288 | | |
289 | 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 | + | |
290 | 323 | | |
291 | 324 | | |
292 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
29 | 51 | | |
30 | 52 | | |
31 | 53 | | |
| |||
55 | 77 | | |
56 | 78 | | |
57 | 79 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 80 | + | |
64 | 81 | | |
65 | 82 | | |
66 | 83 | | |
| |||
71 | 88 | | |
72 | 89 | | |
73 | 90 | | |
74 | | - | |
| 91 | + | |
75 | 92 | | |
76 | 93 | | |
77 | 94 | | |
| |||
0 commit comments