Skip to content

pkg/identifiers: add tests for ValidateDockerCompat - #5088

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
nikolauspschuetz:test-identifiers-validatedockercompat
Aug 1, 2026
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
nikolauspschuetz:test-identifiers-validatedockercompat

Conversation

@nikolauspschuetz

Copy link
Copy Markdown
Contributor

pkg/identifiers had no tests, even though ValidateDockerCompat validates container, volume, and network names throughout the codebase. This adds table-driven coverage: the accepted charset (alphanumeric plus _.-), the Docker-compatible two-character minimum, rejection of leading separators and invalid characters, and the empty-string case. Each error case also asserts the wrapped errdefs.ErrInvalidArgument.

Test-only, no behavior change.

@nikolauspschuetz
nikolauspschuetz force-pushed the test-identifiers-validatedockercompat branch 2 times, most recently from 659e6c2 to f558bab Compare July 21, 2026 14:36
@nikolauspschuetz
nikolauspschuetz marked this pull request as ready for review July 22, 2026 21:46
@AkihiroSuda AkihiroSuda added this to the v2.4.0 milestone Aug 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file name should be <IMPLEMENTATION>_test.go, i.e., validate_test.go

pkg/identifiers had no test coverage, though ValidateDockerCompat gates
container, volume, and network names across the codebase. Add table-driven
tests for the accepted charset, the Docker-compatible two-character minimum,
leading-separator and invalid-character rejection, and the empty case,
asserting both the message and the wrapped errdefs.ErrInvalidArgument.

Signed-off-by: Nikolaus Schuetz <[email protected]>
@nikolauspschuetz
nikolauspschuetz force-pushed the test-identifiers-validatedockercompat branch from f558bab to 99ad6bd Compare August 1, 2026 19:33
@AkihiroSuda
AkihiroSuda merged commit 69b9ce8 into containerd:main Aug 1, 2026
22 checks passed
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.

2 participants