Skip to content

fix(etcd): fail role probe on status errors - #3267

Draft
weicao wants to merge 1 commit into
martin/etcd-memberjoin-idempotencyfrom
martin/etcd-roleprobe-fail-closed
Draft

fix(etcd): fail role probe on status errors#3267
weicao wants to merge 1 commit into
martin/etcd-memberjoin-idempotencyfrom
martin/etcd-roleprobe-fail-closed

Conversation

@weicao

@weicao weicao commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Problem

roleprobe.sh returned exit code 0 with empty stdout when etcdctl endpoint status failed because the top-level command substitution did not propagate get_etcd_role failure. A successful but malformed endpoint response could also produce a false role.

Change

  • propagate get_etcd_role failure from the script entrypoint
  • reject endpoint output missing, malformed, or duplicate MemberID, Leader, or IsLearner fields
  • add focused failure fixtures for endpoint errors, malformed output, duplicate fields, and entrypoint rc propagation

Verification

  • shellspec --load-path ./shellspec --shell /opt/homebrew/bin/bash addons/etcd/scripts-ut-spec/roleprobe_spec.sh: 19 examples, 0 failures
  • shellspec --load-path ./shellspec --default-path addons/etcd/scripts-ut-spec --shell /opt/homebrew/bin/bash: 84 examples, 0 failures
  • bash -n addons/etcd/scripts/roleprobe.sh
  • shellcheck addons/etcd/scripts/roleprobe.sh
  • git diff --check 79c82e3ba6adb532625295a78046b82edd3a2d90..HEAD

This PR is intentionally stacked on exact candidate head 79c82e3ba6adb532625295a78046b82edd3a2d90 and does not change the peer-network/TLS topology path.

@weicao
weicao requested review from a team and leon-ape as code owners July 26, 2026 05:44
@codecov-commenter

codecov-commenter commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 144 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (79c82e3) to head (276a9b4).

Files with missing lines Patch % Lines
addons/etcd/scripts-ut-spec/roleprobe_spec.sh 0.00% 144 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                         @@
##           martin/etcd-memberjoin-idempotency   #3267   +/-   ##
==================================================================
  Coverage                                0.00%   0.00%           
==================================================================
  Files                                     150     150           
  Lines                                   23843   23932   +89     
==================================================================
- Misses                                  23843   23932   +89     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@weicao
weicao force-pushed the martin/etcd-roleprobe-fail-closed branch from 35c36d2 to 276a9b4 Compare July 26, 2026 06:25
@leon-ape
leon-ape marked this pull request as draft July 27, 2026 01:41
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.

2 participants