nri-metadata-injection: Add Global ServiceAccount Annotations Inheritance #678
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds comprehensive explicit test coverage for all 15 applicable global values in the nri-metadata-injection chart. While the chart already supported global values through common-library integration, it lacked explicit helm-unittest tests demonstrating inheritance and precedence behavior. This PR ensures every applicable global value has dedicated test coverage proving it works correctly.
Changes
Added Comprehensive Global Value Tests
New Test File:
tests/global-inheritance_test.yaml(20 tests)global.cluster- inheritance and local precedence (2 tests)global.labels- inheritance and merge behavior (2 tests)global.podLabels- inheritance and merge behavior (2 tests)global.images.registry- inheritance and local precedence (2 tests)global.images.pullSecrets- inheritance and merge behavior (2 tests)global.priorityClassName- inheritance and local precedence (2 tests)global.hostNetwork- inheritance and local precedence (2 tests)global.dnsConfig- inheritance and local precedence (2 tests)global.nodeSelector- inheritance and local precedence (2 tests)global.affinity- inheritance and local precedence (2 tests)New Test File:
tests/serviceaccount-global_test.yaml(4 tests)global.serviceAccount.create- inheritance and local precedence (3 tests)Previously Tested Global Values (Already Had Explicit Tests)
global.tolerations-tests/job_serviceaccount_test.yaml(2 tests)global.serviceAccount.annotations-tests/serviceaccount_annotations_test.yaml(2 tests)global.podSecurityContext-tests/security_context_test.yaml+tests/job_security_context_test.yaml(multiple tests)global.containerSecurityContext-tests/security_context_test.yaml+tests/job_security_context_test.yaml(multiple tests)Test Results
Tests Added: 24 new tests
Previous Tests: 62 tests
Total Coverage: 86 tests covering all 15 applicable global values
Global Values Coverage
All 27 global values from the nri-bundle global contract assessed:
Testing Philosophy: Every applicable global value MUST have explicit helm-unittest test coverage demonstrating:
Coverage Summary: 15/27 global values applicable to webhook charts, all 15 now have explicit tests (100%)
Files Added
charts/nri-metadata-injection/tests/global-inheritance_test.yaml- 20 new tests for cluster, labels, podLabels, images.*, priorityClassName, hostNetwork, dnsConfig, nodeSelector, affinitycharts/nri-metadata-injection/tests/serviceaccount-global_test.yaml- 4 new tests for serviceAccount.create precedenceTest Coverage Validation
Each test validates two critical behaviors:
This ensures consistent precedence behavior (Local > Global > Default) across all 15 applicable global values.
No Breaking Changes
Build Status
Changelog Entry