Skip to content

test(bdd): add function lifecycle command adapters - #1114

Open
sbaum1994 wants to merge 1 commit into
mainfrom
test/bdd-function-lifecycle-dsl
Open

test(bdd): add function lifecycle command adapters#1114
sbaum1994 wants to merge 1 commit into
mainfrom
test/bdd-function-lifecycle-dsl

Conversation

@sbaum1994

@sbaum1994 sbaum1994 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

TL;DR

Add transparent, table-driven nvcf-cli adapters 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-cli and the NVCF API. Repeated options, empty values, unknown options, and product-invalid values pass through unchanged. The deliberate exception is steps phrased successfully, 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.go and 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
  • Feature wiring tests for single-cluster Helmfile, multi-cluster Helmfile, and multi-cluster EKS Helmfile
  • Full local single-cluster Helmfile feature: 6 scenarios and 50 steps passed, including HTTP, gRPC, and LLM lifecycle paths
  • Full local multi-cluster Helmfile run: control-plane install and compute registration passed, then the pre-existing @nvct-task-api scenario stopped the run because the deployed stack still emits the generic RequestICMSInstances action instead of consuming the task-action fix from Self-managed NVCT tasks use the function ICMS request action #1032
  • Targeted live multi-cluster lifecycle run against the installed topology: 2 scenarios and 12 steps passed, including HTTP and plaintext gRPC invocation

The 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

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • New Features

    • Added dedicated BDD steps for configuring the CLI and managing function lifecycles, including creation, deployment, invocation, API-key generation, and undeployment.
    • Added support for HTTP, plaintext gRPC, and model invocation scenarios with structured options.
    • Added safe shell command construction and argument handling.
  • Tests

    • Expanded coverage for command quoting, option forwarding, invocation arguments, validation, and successful command execution.
    • Updated lifecycle scenarios to use the new structured steps while preserving existing assertions.

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>
@sbaum1994
sbaum1994 requested a review from a team as a code owner August 24, 2026 07:03
@sbaum1994
sbaum1994 requested a review from RaitNao August 24, 2026 07:03
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c260bfbb-1289-470d-b6f3-1741877ad9a1

📥 Commits

Reviewing files that changed from the base of the PR and between d2092b0 and 4c04b90.

📒 Files selected for processing (13)
  • tests/bdd/AGENTS.md
  • tests/bdd/PLAN.md
  • tests/bdd/dsl/command.go
  • tests/bdd/dsl/command_test.go
  • tests/bdd/dsl/kubectl.go
  • tests/bdd/features/multi-cluster-eks-helmfile.feature
  • tests/bdd/features/multi-cluster-helmfile.feature
  • tests/bdd/features/single-cluster-helmfile.feature
  • tests/bdd/godog_test.go
  • tests/bdd/steps/command_steps.go
  • tests/bdd/steps/context.go
  • tests/bdd/steps/nvcf_cli_steps.go
  • tests/bdd/steps/nvcf_cli_steps_test.go
💤 Files with no reviewable changes (1)
  • tests/bdd/dsl/kubectl.go

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

Added 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.

Changes

NVCF CLI lifecycle adapters

Layer / File(s) Summary
Shell-safe command construction
tests/bdd/dsl/command.go, tests/bdd/dsl/command_test.go, tests/bdd/dsl/kubectl.go
Added shared POSIX-safe argument quoting and tests. Removed duplicate kubectl quoting helpers.
Step execution and CLI state
tests/bdd/steps/command_steps.go, tests/bdd/steps/context.go, tests/bdd/steps/nvcf_cli_steps.go
Added CLI configuration state, lifecycle step registration, command execution, function and model operations, and option-table validation.
Adapter contract tests
tests/bdd/steps/nvcf_cli_steps_test.go
Tested interpolation, argument forwarding, invocation parameters, exit-code handling, result capture, and table structure.
Feature migration and documentation
tests/bdd/features/*.feature, tests/bdd/godog_test.go, tests/bdd/AGENTS.md, tests/bdd/PLAN.md
Replaced repeated raw lifecycle commands with structured steps and updated wiring assertions and documentation.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 4c04b

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
Loading

Suggested reviewers: raitnao

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses valid Conventional Commits syntax and accurately describes the added BDD function lifecycle command adapters.
Linked Issues check ✅ Passed The PR implements the transparent lifecycle adapters, migrates the specified scenarios, preserves raw negative checks, and adds related documentation and tests for #1106.
Out of Scope Changes check ✅ Passed All changes are confined to tests/bdd documentation, DSL helpers, adapters, feature migrations, and related tests required by #1106.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/bdd-function-lifecycle-dsl

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BDD DSL: Express function lifecycle operations

1 participant