Skip to content

CI: run gpMgmt unit tests in the Behave workflow - #2244

Open
tuhaihe wants to merge 2 commits into
apache:mainfrom
tuhaihe:ci-unit-segment-reconfigurer
Open

tuhaihe wants to merge 2 commits into
apache:mainfrom
tuhaihe:ci-unit-segment-reconfigurer

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Nov 4, 2026

Copy link
Copy Markdown
Member

No CI workflow runs the Python unit tests of gpMgmt. unittest-check runs only the C unit tests, and the Python tests need mock, which only the Behave workflow installs (from gpMgmt/requirements-dev.txt).

Let a Behave matrix entry list unittest_modules instead of behave_features. The job then runs these modules with "python3 -m unittest", with the same PYTHONPATH as "make -C gpMgmt/bin unitdevel", and reads the unittest summary for the results. The Behave entries do not change.

Add the ic-unit-segment-reconfigurer entry, which runs test_unit_segment_reconfigurer.

Assisted-by: Claude Code

Fixes #ISSUE_Number

What does this PR do?

Type of Change

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

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


No CI workflow runs the Python unit tests of gpMgmt.  unittest-check
runs only the C unit tests, and the Python tests need mock, which only
the Behave workflow installs (from gpMgmt/requirements-dev.txt).

Let a Behave matrix entry list unittest_modules instead of
behave_features.  The job then runs these modules with
"python3 -m unittest", with the same PYTHONPATH as
"make -C gpMgmt/bin unitdevel", and reads the unittest summary for the
results.  The Behave entries do not change.

Add the ic-unit-segment-reconfigurer entry, which runs
test_unit_segment_reconfigurer.

Assisted-by: Claude Code
reconfigure() tries to connect again until the mirrors are promoted.
When the connection fails, the except block closes conn.  But when the
first connection fails, conn has no value yet:

  UnboundLocalError: local variable 'conn' referenced before assignment

The error goes out of the retry loop, so gprecoverseg and gpstart stop
and do not wait for the promotion.  In later tries, conn is the closed
connection of the previous try.

Set conn to None before each try, and close it only if it is set.
Now test_unit_segment_reconfigurer passes 3 of 3, instead of 1.

Greenplum fixed this as part of the change to psycopg2 (b5920e061b4).
That change does not apply to Cloudberry, which still uses PyGreSQL.

Backpatch-through: REL_2_STABLE
Assisted-by: Claude Code
@tuhaihe tuhaihe moved this to In Progress in Merge postgres 16 Nov 4, 2026
@tuhaihe

tuhaihe commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Note: This separate PR addresses the failing test and is easy to review; once fixed, I’ll consolidate the similar tests into one.

@leborchuk leborchuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants