pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

test: add basic input validation tests for plugin api structs

Open vanshika2720 opened this issue 6 months ago • 4 comments

What this PR does

Adds basic input validation unit tests for PipeCD Plugin API structs under:

pkg/plugin/api/v1alpha1/...

The tests cover generated:

protoc-gen-validate

validation behavior across:

  • common
  • deployment
  • livestate
  • planpreview

Specifically, this PR adds validation coverage for:

  • Required fields
  • Minimum string length checks
  • Index boundary validation
  • Nested model validation

Why we need it

PipeCD’s plugin API depends on generated validation logic to enforce:

  • Request correctness
  • API schema integrity
  • Plugin contract consistency

at the API boundary.

Adding explicit validation tests helps ensure:

  • Invalid plugin API payloads are rejected early
  • Required API contracts remain enforced
  • Nested validation behavior continues working correctly
  • Future proto/schema changes do not accidentally weaken validation guarantees

This improves:

  • API reliability
  • Contract stability
  • Confidence when evolving plugin interfaces
  • Long-term schema safety

Which issue(s) this PR fixes

Fixes:

#[issue-number]

Does this PR introduce a user-facing change?

No

How are users affected by this change

There is no direct user-facing behavior change.

Developers and maintainers benefit from:

  • Stronger Plugin API validation coverage
  • Better regression protection
  • Improved confidence in request validation behavior

This reduces the risk of validation regressions in plugin-related request handling.


Is this a breaking change

No

How to migrate (if breaking change)

N/A

Verification

Verified locally using:

go test ./pkg/plugin/api/v1alpha1/...
go test ./pkg/plugin/api/v1alpha1/deployment -v

All Plugin API validation tests pass successfully, including:

  • Required-field validation
  • Nested validation
  • Boundary validation cases
  • Generated PGV constraint enforcement

vanshika2720 avatar May 18 '26 18:05 vanshika2720

@rahulshendre @khanhtc1202 @eeshaanSA

vanshika2720 avatar May 18 '26 18:05 vanshika2720

PR is too dependent on AI. Follow template here: https://github.com/pipe-cd/pipecd/blob/master/.github/PULL_REQUEST_TEMPLATE.md

mohammedfirdouss avatar May 19 '26 22:05 mohammedfirdouss

whats the objective of this PR, what is been tested. It is hard to know the changes here.

mohammedfirdouss avatar May 19 '26 22:05 mohammedfirdouss

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 20 '26 00:06 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity. Feel free to reopen if still applicable.

github-actions[bot] avatar Jun 28 '26 00:06 github-actions[bot]