Skip to content

test(gpu): add e2e tests with fake NVML library#2421

Open
vimalk78 wants to merge 1 commit intosustainable-computing-io:mainfrom
vimalk78:e2e-gpu-fake
Open

test(gpu): add e2e tests with fake NVML library#2421
vimalk78 wants to merge 1 commit intosustainable-computing-io:mainfrom
vimalk78:e2e-gpu-fake

Conversation

@vimalk78
Copy link
Copy Markdown
Collaborator

Introduce a fake libnvidia-ml.so.1 (C shared library) that go-nvml
loads via dlopen, returning canned GPU data from a JSON config file.
This enables testing the full GPU metrics pipeline without real
NVIDIA hardware.

  • fake_nvml.c: 44 NVML symbols, reads config from FAKE_NVML_CONFIG env
  • cJSON vendored (MIT) for JSON parsing in C
  • 7 test cases: discovery, power, idle, process attribution, multi-GPU, energy consistency, graceful degradation
  • Makefile test-e2e-gpu target
  • Documentation in docs/developer/e2e-testing.md

  Introduce a fake libnvidia-ml.so.1 (C shared library) that go-nvml
  loads via dlopen, returning canned GPU data from a JSON config file.
  This enables testing the full GPU metrics pipeline without real
  NVIDIA hardware.

  - fake_nvml.c: 44 NVML symbols, reads config from FAKE_NVML_CONFIG env
  - cJSON vendored (MIT) for JSON parsing in C
  - 7 test cases: discovery, power, idle, process attribution, multi-GPU,
    energy consistency, graceful degradation
  - Makefile test-e2e-gpu target
  - Documentation in docs/developer/e2e-testing.md

Signed-off-by: Vimal Kumar <vimal78@gmail.com>
@github-actions github-actions Bot added the test Adding or updating tests label Feb 16, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (8bc5daf) to head (588a741).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2421   +/-   ##
=======================================
  Coverage   91.72%   91.72%           
=======================================
  Files          54       54           
  Lines        5270     5270           
=======================================
  Hits         4834     4834           
  Misses        316      316           
  Partials      120      120           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vprashar2929
Copy link
Copy Markdown
Collaborator

@vimalk78 Will this help in case of k8s env as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Adding or updating tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants