Refactor Validation and Error Handling in cmd/onboard.go and Related Unit Tests
Estimation
Story points: 3 SP
Estimated focus duration (perfect conditions): 3 days
Estimated pessimistic duration (worst case scenario): 5 days
Description
Click to expand
Who
What
- The current implementation of the
onboard
command groups the validation of required flags into a single check, resulting in a generic error message when any of the flags are missing or invalid. This approach can lead to confusion, as users are not informed about which specific flag(s) caused the error.
How
-
Individual Flag Validation: Implement individual checks for each required flag (
memory
,cpu
,channel
,address
,ntx-price
) to determine if they are provided and valid. - Detailed Error Messages: For each validation check, return a detailed error message that specifies which flag is missing or invalid, along with any specific requirements or constraints for that flag.
-
Refactor Unit Tests: Update the onboard CLI unit tests (
cmd/onboard_test.go
) to cover the new error handling logic.
Why
- To improve user experience and reduce time spent on troubleshooting command usage errors.
When
Acceptance Criteria
Click to expand
- Code review
Work Breakdown Structure (WBS)
Task | Description | Duration | Status | Start Date | End Date | Comment |
---|---|---|---|---|---|---|
A | Implement individual checks for flags in cmd/onboard.go | 4 Hrs | Done | 16th May | 16th May | |
B | Accomodate the changes made to the onboard file by adjusting cmd/onboard_test.go | 5 Hrs | Done | 16th May | 20th May | |
C | Test the onboard functionality along with the unit tests | 6 Hrs | Done | 20th May | 22nd May |
Edited by Faisal Dulaimy