test(bdd): add function lifecycle command adapters - #1114
Conversation
Keep product validation in nvcf-cli and the NVCF API while making successful lifecycle scenarios easier to read. Refs: #1106 Signed-off-by: Stephanie Baum <sbaum@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (13)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughAdded reusable BDD adapters for NVCF CLI function and model lifecycle operations. Added shell-safe command construction, option-table validation, execution-result handling, tests, documentation, and migrated single- and multi-cluster scenarios. ChangesNVCF CLI lifecycle adapters
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This PR reorganizes BDD lifecycle command adapters and feature wiring without changing production behavior; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Gherkin
participant nvcf_cli_steps
participant nvcf_cli
Gherkin->>nvcf_cli_steps: provide lifecycle step and arguments
nvcf_cli_steps->>nvcf_cli_steps: interpolate and quote arguments
nvcf_cli_steps->>nvcf_cli: run one configured command
nvcf_cli-->>nvcf_cli_steps: return command result
nvcf_cli_steps-->>Gherkin: record result and assert success
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
TL;DR
Add transparent, table-driven
nvcf-cliadapters for successful function lifecycle scenarios. Migrate the local single-cluster, local multi-cluster, and multi-cluster EKS Helmfile features so their product inputs remain visible without repeating the executable, config, fixed subcommand, quoting, or exit-zero assertion.Additional Details (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)
The lifecycle scenarios repeated long raw commands and a separate exit-code assertion for every successful CLI action. This made the user workflow harder to scan and mixed command mechanics with the behavior under test.
This change adds one config-selection step and thin adapters for function creation, deployment, API-key generation, HTTP invocation, plaintext gRPC invocation, model invocation, and undeployment. The adapters assemble one CLI command, record its real result for existing output assertions, and use shared POSIX argument quoting. The BDD guidance, step catalog, wiring checks, and focused unit tests are updated with the same contract.
Governing contract
The lifecycle DSL is a transparent command adapter. It validates only Gherkin table structure, passes every supplied CLI option and value in order, does not add product validation, defaulting, or state, and leaves product behavior to
nvcf-cliand the NVCF API. Repeated options, empty values, unknown options, and product-invalid values pass through unchanged. The deliberate exception is steps phrasedsuccessfully, which assert exit code 0. Negative and exit-code-specific scenarios continue using raw command steps.Customer release notes: Not customer visible.
Infrastructure plan summary: Not applicable. The feature workflows are unchanged.
Dependencies: None. No license review or NOTICE update is needed.
For the Reviewer
Please focus on
tests/bdd/steps/nvcf_cli_steps.goand its tests. The important boundary is that these steps improve readability without duplicating API or CLI validation.For QA (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)
Local validation:
go test -short ./..../scripts/lint.sh@nvct-task-apiscenario stopped the run because the deployed stack still emits the genericRequestICMSInstancesaction instead of consuming the task-action fix from Self-managed NVCT tasks use the function ICMS request action #1032The first single-cluster attempt encountered local Docker disk pressure. After pruning unused images and recreating a fresh
ncp-local, the complete feature passed. Live EKS was not run; the EKS feature passed its local wiring test.No additional QA is required for the local adapters. A live EKS run can validate the migrated EKS scenario when that environment is available.
Issues
Closes #1106
Checklist
Summary by CodeRabbit
New Features
Tests