feat: add virtwork validate subcommand for catalog entries#205
Merged
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mrhillsman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Validates catalog entries structurally without deploying: checks YAML parsing, service file presence, storage/service constraints, and placeholder consistency via ValidatePlaceholders. Usage: virtwork validate [entry-names...] [--catalog-dir path] Exits 0 if all pass, non-zero with per-entry errors on failure. Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
e302fd3 to
b8aa2ff
Compare
- Use wrapped static errors (err113): add ErrNoEntries and ErrValidationFailed sentinels, wrap with %w in validateE - Check fmt.Fprintf return values (errcheck): prefix with _, _ - Remove trailing blank lines in main_test.go (gci) - Break long line in validatee_test.go (golines) - Use 0o600 file permissions in test helper (gosec G306) Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
virtwork validate [entry-names...] [--catalog-dir path]subcommand for structural validation of catalog entries without deployingBindValidateFlagstointernal/config/config.go(binds--catalog-dir)newValidateCmd()andvalidateE()tocmd/virtwork/main.go, wired into root commandValidatePlaceholdersOK,WARN, orFAILper entry; exits non-zero if any entry failsmain_test.go, 6 functional tests invalidatee_test.goTest plan
ginkgo -v --focus "validateE|Validate command" ./cmd/virtwork/— all 8 tests passgo run ./cmd/virtwork validate --catalog-dir ./catalog— validates shipped entries, exits 0go run ./cmd/virtwork validate --catalog-dir ./catalog sysbench— single entry, exits 0go run ./cmd/virtwork validate --catalog-dir /nonexistent— exits non-zerogo test ./...— full suite green, no regressionsResolves #202