Skip to content

Fix test_unit_gprecoverseg for standbyCoordinator - #2367

Draft
tuhaihe wants to merge 1 commit into
apache:mainfrom
tuhaihe:fix-test-unit-gprecoverseg
Draft

tuhaihe wants to merge 1 commit into
apache:mainfrom
tuhaihe:fix-test-unit-gprecoverseg

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Nov 20, 2026

Copy link
Copy Markdown
Member

What does this PR do?

gprecoverseg reads gpArray.standbyCoordinator when the cluster has no
mirrors (c867979). The test uses MagicMock(spec=GpArray), and
standbyCoordinator is set in GpArray.init(), not on the class. So
the mock has no such attribute and test_gprecoverseg_with_mirrorless
failed with an AttributeError.

Set standbyCoordinator to None on the mock.

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Test Plan

  • Unit tests added/updated

gppylib.test.unit.test_unit_gprecoverseg passes as gpadmin in a cbdb-build-rocky9 container with mock 5.0.0 and a
demo cluster, run from gpMgmt/bin with:

PYTHONPATH=.:../sbin:$PYTHONPATH:ext:lib:gppylib python3 -m unittest -v gppylib.test.unit.test_unit_gprecoverseg

Checklist

Additional Context

No CI job runs this module today, which is why the failure was not seen.
I found it while adding the gpMgmt unit tests to the Behave workflow
(branch ci-more-gpmgmt-unit-tests). After that change and this PR
are merged, gppylib.test.unit.test_unit_gprecoverseg can be added to the ic-unit-gpmgmt list.

gprecoverseg reads gpArray.standbyCoordinator when the cluster has no
mirrors (c867979).  The test uses MagicMock(spec=GpArray), and
standbyCoordinator is set in GpArray.__init__(), not on the class.  So
the mock has no such attribute and test_gprecoverseg_with_mirrorless
failed with an AttributeError.

Set standbyCoordinator to None on the mock.

Backpatch-through: REL_2_STABLE
Assisted-by: Claude Code
@tuhaihe
tuhaihe marked this pull request as draft November 20, 2026 07:01
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.

1 participant