Skip to content

Conversation

@karthikvetrivel
Copy link
Member

Resolves TODO to mock parseOSRelease instead of using environment variable check.

Design Decision:
I used function variable pattern (vs interface) for simplicity. This matches the stdlib approach (e.g., time.Now) and keeps changes minimal.

Testing:
All existing tests pass with mock enabled. No production code behavior changed.

Note: I also added defer f.Close() to prevent file descriptor leaks

@karthikvetrivel karthikvetrivel force-pushed the refactor/mock-os-release-parser branch from 23eebb0 to 4941ca9 Compare October 27, 2025 16:49
@karthikvetrivel karthikvetrivel force-pushed the refactor/mock-os-release-parser branch from 4941ca9 to 2db4d0a Compare October 27, 2025 23:41
@karthikvetrivel
Copy link
Member Author

@cdesiniotis I added this snippet:

originalPath := osReleaseFilePath
defer func() { osReleaseFilePath = originalPath }()

to make sure that osReleaseFilePath gets restored to its original value after the test completes. Now, this only matters if we have later tests that use it as well (which may be unlikely). Let me know if we should keep it.

@cdesiniotis cdesiniotis merged commit d0e377a into NVIDIA:main Oct 28, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants