feat(infra-monitoring): v2 statefulsets integration tests#11440
Open
nikhilmantri0902 wants to merge 1 commit into
Open
feat(infra-monitoring): v2 statefulsets integration tests#11440nikhilmantri0902 wants to merge 1 commit into
nikhilmantri0902 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request
📄 Summary
First end-to-end integration tests for
POST /api/v2/infra_monitoring/statefulsets.Screenshots / Screen Recordings (if applicable)
N/A — backend test addition; no UI.
Issues closed by this PR
Part of https://github.com/SigNoz/engineering-pod/issues/4980
✅ Change Type
🐛 Bug Context
N/A — not a bug fix.
🧪 Testing Strategy
53 tests across 21 functions in
tests/integration/tests/inframonitoring/08_statefulsets.py+ 9 JSONL datasets + 1 expected-values JSON (generated bytests/gen_statefulsets_datasets.py).test_statefulsets_happy_path— shape, 11 record fields (statefulSetName, 6 float metrics,desiredPods/currentPodsasint,podCountsByPhase,meta); meta carriesk8s.statefulset.name/k8s.namespace.name/k8s.cluster.nametest_statefulsets_value_accuracy— exact 6 float metric values + replica counts + phase counts. Locks in Sum vs Avg split: cpu/memory = SpaceAggregationSum; cpu_request/limit +memory_request/limit = SpaceAggregationAvg; desired/current = latest-summed. v1/v2 parity confirmed by code reading (
pkg/query-service/app/inframetrics/statefulsets.go:21-90↔pkg/modules/inframonitoring/implinframonitoring/statefulsets_constants.go:24-242)test_statefulsets_missing_metrics— seed onlyk8s.pod.cpu.usage, other 8 of 9 required metrics flagged → records=[], total=0test_statefulsets_filter_and / in / not_in / contains— each QB v5 operatortest_statefulsets_filter_combos×4 — AND+IN, AND+NOT IN, AND+CONTAINS, IN+CONTAINStest_statefulsets_filter_bad_attr_name,test_statefulsets_filter_bad_grammar×2 — 400 pathstest_statefulsets_pod_phase_aggregation— 4 Running + 1 Pending + 2 Failedtest_statefulsets_desired_current_counts— desired=5, current=3, only 2 Running pods seeded. Locks ininttyping + distinguishes replica counts from phase counts (separate code paths); models ascale-up in progress
test_statefulsets_base_filter_drops_non_statefulset_pods— seed 1 SS pod + 1 standalone pod (nok8s.statefulset.name) + 1 Deployment pod (k8s.deployment.nameonly); only the real SS rowappears. Documents
statefulSetsBaseFilterExpr(statefulsets_constants.go:10,:63-69)test_statefulsets_groupby_namespace—groupBy=[k8s.namespace.name]→ 2 records,statefulSetName="", meta surfacesk8s.namespace.nametest_statefulsets_pagination_sync— K=7, limit=3, offsets {0,3,6}: page invariants, total invariant, full partitiontest_statefulsets_offset_beyond_total— empty records, total unchangedtest_statefulsets_total_invariant_across_orderby— 8 metric columns × 2 directions = 16 calls,total==Ktest_statefulsets_orderby_correctness×16 — 8 columns (cpu,cpu_request,cpu_limit,memory,memory_request,memory_limit,desired_pods,current_pods) × 2 directions. Exercises everyentry in
orderByToStatefulSetsQueryNamestest_statefulsets_orderby_by_statefulset_name×2 — metadata-name branch (PaginateMetadataByName)test_statefulsets_validation_errors×12 — allValidate()rules includingorderBy=k8s.statefulset.name+ non-empty groupBy rejectiontest_statefulsets_auth×2 — 401 no token, 200 adminManual verification:
📝 Changelog
📋 Checklist
👀 Notes for Reviewers