Skip to content

Conversation

@hhiroshell
Copy link
Owner

Summary

This PR adds comprehensive unit tests for the core business logic of kubectl-realname-diff:

  • Test_realName() - Validates label extraction logic for the realname-diff/realname label
  • Test_RealnameDiffInfoObject_nameChanged() - Tests name comparison between local and live objects
  • Test_RealnameDiffInfoObject_Live() - Tests security-critical annotation stripping for Secrets and ConfigMaps when names differ

These unit tests cover the core functionality without requiring Kubernetes API server integration. Integration tests for API server interactions (like getWithRealName()) will be added separately.

Test plan

  • All new tests pass: go test ./pkg/cmd/...
  • Code passes vet: go vet ./...
  • Code passes fmt: go fmt ./...
  • Code passes staticcheck: staticcheck ./...
  • Full test suite passes: make test

🤖 Generated with Claude Code

Adds comprehensive unit tests for:
- realName() label extraction logic
- nameChanged() comparison method
- Live() annotation stripping (security-critical for Secrets)

These tests cover the core business logic without requiring API server
integration, which will be added separately.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@hhiroshell hhiroshell merged commit abc5df6 into main Dec 26, 2025
1 check passed
@hhiroshell hhiroshell deleted the add-unit-tests branch December 26, 2025 05:31
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