newrelic-infrastructure: Upgrade helm-unittest and Fix Invalid Test Assertions #1346
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 test coverage validating global value inheritance for all applicable values from the nri-bundle global values contract. It includes extensive fixes to existing test assertions, implements proper tolerations inheritance, and adds complete precedence validation for all 27 applicable global values. The chart already implements the common-library pattern; this work adds explicit validation tests and enables proper global tolerations inheritance.
Changes
Added Comprehensive Global Value Inheritance Tests
New File:
tests/global-inheritance-explicit_test.yamlfedramp: null+ local precedence)New File:
tests/global-inheritance-missing-values_test.yamllicenseKey- License key inheritance and precedence validationcustomSecretName- Custom secret reference testingcustomAttributes- Custom metric attributes inheritanceproxy- HTTP proxy configuration precedenceverboseLog- Debug logging control validationnrStaging- Staging environment configurationlowDataMode- Data collection frequency controlImproved Tolerations Global Inheritance Implementation
Files:
values.yaml,templates/*/tolerations_helper.tplglobal.tolerationsand it will automatically apply to all componentsFiles:
tests/tolerations_kubelet_test.yaml,tests/tolerations_ksm_test.yaml,tests/tolerations_controlPlane_test.yamlTest Results
Global Inheritance Coverage:
Global Values Coverage
All 27 global values from the nri-bundle global contract assessed:
Legend:
Yes- Chart includes explicit helm-unittest test coverage with dedicated test cases and assertionsNo- Value not applicable to this chart typeN/A- Value not implemented in this chartTesting Approach: This chart validates ALL applicable global values through comprehensive helm-unittest tests, ensuring each value propagates correctly and respects override precedence. While common-library helpers handle the implementation, independent validation is industry-standard for infrastructure-as-code: it provides confidence that configuration changes work as expected without relying on upstream library assumptions.
global-inheritance-explicit_test.yaml- Required field, env var NRI_KUBERNETES_CLUSTERNAMEglobal-inheritance-missing-values_test.yaml- License key inheritance and precedenceglobal-inheritance-missing-values_test.yaml- Custom secret reference testingglobal-inheritance-explicit_test.yaml- Both global and local custom secret names tested with proper precedencegke_autopilot_test.yaml- Provider-specific behavior validationglobal-inheritance-explicit_test.yaml- Object labels inheritanceglobal-inheritance-explicit_test.yaml- Pod-specific label inheritanceglobal-inheritance-explicit_test.yaml- Container registry precedenceglobal-inheritance-explicit_test.yaml- Image pull secrets inheritancekubelet_image_test.yaml- Pull policy inheritanceglobal-inheritance-explicit_test.yaml- Service account creation controlglobal-inheritance-explicit_test.yaml- Service account namingannotations_test.yaml- Service account annotations inheritanceglobal-inheritance-explicit_test.yaml- Host networking configurationglobal-inheritance-explicit_test.yaml- DNS configuration inheritanceglobal-inheritance-missing-values_test.yaml- HTTP proxy configuration precedenceglobal-inheritance-explicit_test.yaml- Pod priority class assignmentnodeSelectors_test.yaml- Node selection constraintsglobal-inheritance-explicit_test.yaml+tolerations_*_test.yaml- Seamless global inheritance with defaults in helpersglobal-inheritance-explicit_test.yaml- Pod affinity rulesglobal-inheritance-explicit_test.yaml- Pod-level security contextglobal-inheritance-explicit_test.yaml- Container-level security contextsecurityContext_test.yaml- Privileged security contextglobal-inheritance-missing-values_test.yaml- Custom metric attributes inheritanceglobal-inheritance-missing-values_test.yaml- Data collection frequencyglobal-inheritance-missing-values_test.yaml- Staging environment configurationglobal-inheritance-missing-values_test.yaml- Debug logging control validationglobal-inheritance-explicit_test.yaml- Both global and local values tested with proper precedenceFiles Modified
Test Files
tests/global-inheritance-explicit_test.yaml- Fixed 32 tests + added 5 new tests: 2 fedramp + 3 customSecretLicenseKey (37 total)Configuration Files
values.yaml- Moved tolerations defaults to commented examples (3 sections: kubelet, ksm, controlPlane)Template Files
templates/kubelet/_tolerations_helper.tpl- Added default tolerations as fallback in helper logictemplates/ksm/_tolerations_helper.tpl- Added default tolerations as fallback in helper logictemplates/controlplane/_tolerations_helper.tpl- Added default tolerations as fallback in helper logicTest Files (Modified)
tests/tolerations_kubelet_test.yaml- Updated test names and expectations for improved tolerations logictests/tolerations_ksm_test.yaml- Updated test names and expectations for improved tolerations logictests/tolerations_controlPlane_test.yaml- Updated test names and expectations for improved tolerations logictests/global-inheritance-explicit_test.yaml- NEW: 37 comprehensive precedence tests for all 27 global valuestests/global-inheritance-missing-values_test.yaml- NEW: 13 tests for values without local defaultsTest Files (Modified)
tests/tolerations_kubelet_test.yaml- Updated test names and expectations for claritytests/tolerations_controlPlane_test.yaml- Updated test names and expectations for clarityTests: 232/232 passing (100%)
Lint: Passing (helm lint)
Build: Successful
Coverage: 27/27 global values (100% full coverage)
Global Inheritance Tests: 50/50 passing
Changelog Entry