Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: test_update_ecosystems #4929

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

22f1001635
Copy link
Contributor

Summary

This PR addresses the failing test in test_source_osv.py::TestSourceOSV::test_update_ecosystems caused by a mismatch between the ecosystems listed in the remote ecosystems.txt and the ecosystems obtained via gsutil. The discrepancy was primarily due to the inclusion of an invalid [EMPTY] entry in the remote file and versioned ecosystem entries (e.g. AlmaLinux:8) that need to be mapped to their parent ecosystem names.

Changes Introduced

  • Invalid Entry Removal:

    • Discards the [EMPTY] entry from the set of expected ecosystems derived from ecosystems.txt.
  • Manual Adjustments:

    • Adds missing parent ecosystem entries (DWF and JavaScript) in the gsutil output but not in the remote file.
  • Parent Ecosystem Extraction:

    • Updates the test to extract parent ecosystem names from versioned entries by splitting on :, ensuring that entries like AlmaLinux:8 are correctly mapped to AlmaLinux.
  • Performance Consideration:

    • Relying solely on the ecosystems.txt file for ecosystem selection avoids redundant downloads and duplicate JSON processing.

Checklist

  • ✅ Code adheres to the project’s coding standards.
  • ✅ All tests pass successfully.
  • ✅ The changes are backward-compatible and consistent with OSV's intended data handling.

Steps to Test

  1. Set the environment variable for external system tests:
    EXTERNAL_SYSTEM=1 pytest test/test_source_osv.py::TestSourceOSV::test_update_ecosystems
    

Verify that:

  • The test passes without errors.
  • The parent ecosystems extracted from the gsutil listings match the adjusted list from ecosystems.txt (with [EMPTY] removed and DWF and JavaScript added).

Related Issues
Fixes #4633

Additional Notes

  • This fix assumes that the general ecosystem listing provided by ecosystems.txt is sufficient for selecting the correct ecosystems.
  • The manual additions and parent extraction logic reconcile the differences between the gsutil output and the remote file, aligning with the OSV data model and improving performance.

@22f1001635 22f1001635 force-pushed the fix--test_source_osv branch 2 times, most recently from 9c173eb to 16ed5d7 Compare March 10, 2025 20:15
@22f1001635 22f1001635 force-pushed the fix--test_source_osv branch from 16ed5d7 to 1ff3f26 Compare March 14, 2025 09:31
@22f1001635 22f1001635 force-pushed the fix--test_source_osv branch from 1ff3f26 to b892bab Compare March 18, 2025 08:31
@22f1001635
Copy link
Contributor Author

@terriko required changes have been made please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants