Skip to content

feat(infra-monitoring): v2 daemonsets integration tests - #11442

Merged
nikhilmantri0902 merged 138 commits into
mainfrom
infraM/v2_daemonsets_integration_tests
Jun 15, 2026
Merged

feat(infra-monitoring): v2 daemonsets integration tests#11442
nikhilmantri0902 merged 138 commits into
mainfrom
infraM/v2_daemonsets_integration_tests

Conversation

@nikhilmantri0902

Copy link
Copy Markdown
Contributor

Pull Request


📄 Summary

First end-to-end integration tests for POST /api/v2/infra_monitoring/daemonsets.

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

  • 🧪 Test-only

🐛 Bug Context

N/A — not a bug fix.


🧪 Testing Strategy

53 tests across 21 functions in tests/integration/tests/inframonitoring/10_daemonsets.py + 9 JSONL datasets + 1 expected-values JSON (generated by tests/gen_daemonsets_datasets.py).

  • test_daemonsets_happy_path — shape, 11 record fields (daemonSetName, 6 float metrics, desiredNodes/currentNodes as int, podCountsByPhase, meta); meta carries
    k8s.daemonset.name/k8s.namespace.name/k8s.cluster.name
  • test_daemonsets_value_accuracy — exact 6 float metric values + node 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/daemonsets.go:21-90
    pkg/modules/inframonitoring/implinframonitoring/daemonsets_constants.go:24-242)
  • test_daemonsets_missing_metrics — seed only k8s.pod.cpu.usage, other 8 of 9 required metrics flagged → records=[], total=0
  • test_daemonsets_filter_and / in / not_in / contains — each QB v5 operator
  • test_daemonsets_filter_combos ×4 — AND+IN, AND+NOT IN, AND+CONTAINS, IN+CONTAINS
  • test_daemonsets_filter_bad_attr_name, test_daemonsets_filter_bad_grammar ×2 — 400 paths
  • test_daemonsets_pod_phase_aggregation — 4 Running + 1 Pending + 2 Failed
  • test_daemonsets_desired_current_counts — desired=5, current=3 (node-scheduling lag — DS targets 5 nodes, only 3 currently scheduled), 2 Running pods seeded. Locks in int typing + distinguishes
    node counts from phase counts
  • test_daemonsets_base_filter_drops_non_daemonset_pods — seed 1 DS pod + 1 standalone + 1 Deployment pod + 1 StatefulSet pod; only the real DS row appears. Documents daemonSetsBaseFilterExpr
    (daemonsets_constants.go:10, :63-69)
  • test_daemonsets_groupby_namespacegroupBy=[k8s.namespace.name] → 2 records, daemonSetName="", meta surfaces k8s.namespace.name
  • test_daemonsets_pagination_sync — K=7, limit=3, offsets {0,3,6}: page invariants, total invariant, full partition
  • test_daemonsets_offset_beyond_total — empty records, total unchanged
  • test_daemonsets_total_invariant_across_orderby — 8 metric columns × 2 directions = 16 calls, total==K
  • test_daemonsets_orderby_correctness ×16 — 8 columns (cpu, cpu_request, cpu_limit, memory, memory_request, memory_limit, desired_nodes, current_nodes) × 2 directions. Exercises every
    entry in orderByToDaemonSetsQueryNames
  • test_daemonsets_orderby_by_daemonset_name ×2 — metadata-name branch (PaginateMetadataByName)
  • test_daemonsets_validation_errors ×12 — all Validate() rules including orderBy=k8s.daemonset.name + non-empty groupBy rejection
  • test_daemonsets_auth ×2 — 401 no token, 200 admin

Manual verification:

  • 53/53 daemonsets green on first run (~54 s)
  • Full inframonitoring suite: 473/473 green (39 hosts + 45 pods + 43 nodes + 37 namespaces + 44 clusters + 48 volumes + 53 deployments + 53 statefulsets + 58 jobs + 53 daemonsets, ~7 min 51 s)

⚠️ Risk & Impact Assessment

  • Blast radius: none — test-only, no product code changes
  • Potential regressions: none; CI runtime grows by ~54 s for this file
  • Rollback plan: revert — no migrations, no shared state

📝 Changelog

Field Value
Deployment Type N/A
Change Type N/A
Description N/A — internal test addition, not user-facing

📋 Checklist

  • Tests added or explicitly not required
  • Manually tested (53/53 green; full inframonitoring suite 473/473)
  • Breaking changes documented (none — test-only)
  • Backward compatibility considered (N/A — test-only)

👀 Notes for Reviewers

nikhilmantri0902 and others added 30 commits May 21, 2026 20:09
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nikhilmantri0902 and others added 6 commits June 9, 2026 12:09
- rename groupby_namespace -> test_statefulsets_groupby, parametrize over
  k8s.statefulset.name + k8s.namespace.name; adds the statefulset-name-in-groupBy
  branch (statefulSetName populated) that the other endpoints all cover

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- rename groupby_namespace -> test_jobs_groupby, parametrize over
  k8s.job.name + k8s.namespace.name; adds the job-name-in-groupBy branch
  (jobName populated) that the other endpoints all cover

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- rename groupby_namespace -> test_daemonsets_groupby, parametrize over
  k8s.daemonset.name + k8s.namespace.name; adds the daemonset-name-in-groupBy
  branch (daemonSetName populated) that the other endpoints all cover

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nikhilmantri0902 nikhilmantri0902 added safe-to-integrate Run integration tests and removed safe-to-integrate Run integration tests labels Jun 9, 2026
@CLAassistant

CLAassistant commented Jun 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@nikhilmantri0902 nikhilmantri0902 added safe-to-integrate Run integration tests and removed safe-to-integrate Run integration tests labels Jun 10, 2026
Base automatically changed from infraM/v2_jobs_integration_tests to main June 14, 2026 09:36
@nikhilmantri0902
nikhilmantri0902 added this pull request to the merge queue Jun 15, 2026
Merged via the queue into main with commit 4f3b764 Jun 15, 2026
19 checks passed
@nikhilmantri0902
nikhilmantri0902 deleted the infraM/v2_daemonsets_integration_tests branch June 15, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request safe-to-integrate Run integration tests staging:fleet-monarch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants