Commit f6a67bd
DAOS-18304 ddb: add Go unit tests using build-tag CGo stubs
Introduce the Go test suite for the ddb CLI layer, built on top of the
build-tag CGo stub infrastructure landed in #18124:
- Add test_helpers.go: newTestContext(t) resets all CGo stubs via
resetDdbStubs() and returns a *DdbContext ready for use in tests.
Test cases set per-function _Fn hook variables directly.
- All test files carry the //go:build test_stubs tag so they only
compile when the stub infrastructure is present.
- TestCmds: open (default, write_mode, db_path), feature (show, enable,
disable), and dtx_aggr (mutual exclusion, cmt_time, cmt_date, path).
Adds skipCmdLine field for flags shared between CLI and grumble layers.
- TestHelpCmds: unknown-command help flow.
- TestParseOpts / TestRun: CLI-level option parsing and run() dispatch,
including unknown-command detection for both command-line and
command-file paths.
- TestNewLogger: 6 sub-cases (default level, explicit debug, invalid
level, valid LogDir, non-existent LogDir, LogDir is a file).
- TestClosePoolIfOpen: Close not called when already closed, called when
open, Close error tolerated.
Test-tag: unittest
Required-githooks: yes
Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>1 parent a7e9aa4 commit f6a67bd
4 files changed
Lines changed: 1104 additions & 9 deletions
File tree
- src/control/cmd/ddb
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
1 | 7 | | |
2 | 8 | | |
3 | 9 | | |
| |||
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
30 | | - | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
34 | | - | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | | - | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | | - | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
58 | | - | |
59 | | - | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
118 | 123 | | |
119 | 124 | | |
120 | 125 | | |
121 | | - | |
| 126 | + | |
122 | 127 | | |
123 | 128 | | |
124 | 129 | | |
| |||
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
172 | | - | |
| 177 | + | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
0 commit comments