Skip to content

Unify the UT (Unit Testing) Framework for the Fluid Project #5322

@RongGu

Description

@RongGu

Unify the UT (Unit Testing) Framework for the Fluid Project, Including:*

  1. Replace gohook with gomonkey to implement a more modern and compatible monkey-patching solution.
  2. Promote ginkgo and gomega to gradually replace testify, enabling a more structured BDD-style testing approach.

Why This Feature Is Needed:

  1. gohook lacks active maintenance and has insufficient compatibility with newer Go versions, posing high upgrade risks. gomonkey has a more active community, richer documentation, and examples. Recommendation: Use monkey-patching only when interface mocking is infeasible; ensure strict control over patch/restore timing and concurrency safety.
  2. testify/assert assertions are simple but inadequate for expressing complex test structures. The ginkgo BDD framework provides comprehensive lifecycle hooks and more readable test case structures, making it suitable for standardizing Fluid’s testing practices and CI protocols.

Proposed Implementation Plan:

  • Audit repository usage of gohook and testify.
  • Conduct pilot migrations (PoC) of gomonkey and ginkgo in core components/typical modules to validate compatibility and CI performance.
  • Implementation reference: See PR #5212 for practical migration examples.
  • Migrate incrementally by package; add patch/restore safety checks in CI, prohibiting concurrent monkey-patching tests.
  • Develop migration guidelines and best practices documentation; organize team-wide training and discussions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions