Skip to content

tests:make robustness report id match log id#21228

Open
madhav-murali wants to merge 1 commit intoetcd-io:mainfrom
madhav-murali:feat/member-id-report-fix
Open

tests:make robustness report id match log id#21228
madhav-murali wants to merge 1 commit intoetcd-io:mainfrom
madhav-murali:feat/member-id-report-fix

Conversation

@madhav-murali
Copy link

Fixes #21211
This PR updates the MemberID JSON marshaling to use hexadecimal format (instead of decimal) in the robustness report. This ensures that the member-id in operations.json matches the format used in logs.

I haven't added unit tests, because I wasn't sure. Ran make test-robustness and verified with the operations.json file to ensure member-id matched.
Signed-off-by: Madhav Murali mdvmrli@gmail.com

@k8s-ci-robot
Copy link

Hi @madhav-murali. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.


type MemberID uint64

// MarshallJson implements the json.Marshaler interface for MemberID.
Copy link
Member

Choose a reason for hiding this comment

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

nit: inconsistent with the func name and not rhyme.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed the typo, thanks

@madhav-murali madhav-murali force-pushed the feat/member-id-report-fix branch from 02c34b4 to decc822 Compare January 31, 2026 17:30
Comment on lines 147 to 150
func (m MemberID) MarshalJSON() ([]byte, error) {
return json.Marshal(fmt.Sprintf("%x", m))
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this is correct though. This looks like we're just converting uint64 into a hex value. Have you tested this that the values actually match?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah i did confirm that the MemberID's generated in the operations.json file appear in the server logs in hexa format.

Copy link
Member

Choose a reason for hiding this comment

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

sounds good.

@madhav-murali madhav-murali requested a review from nwnt February 1, 2026 16:22
@serathius
Copy link
Member

serathius commented Feb 1, 2026

/ok-to-test

Please add tests comparing output of model and type.ID

@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.40%. Comparing base (d89978e) to head (d6edb51).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

see 21 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #21228      +/-   ##
==========================================
- Coverage   68.41%   68.40%   -0.02%     
==========================================
  Files         429      429              
  Lines       35288    35288              
==========================================
- Hits        24142    24137       -5     
- Misses       9751     9755       +4     
- Partials     1395     1396       +1     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d89978e...d6edb51. Read the comment docs.

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

@madhav-murali madhav-murali force-pushed the feat/member-id-report-fix branch from decc822 to 47c401a Compare February 1, 2026 19:24
@k8s-ci-robot k8s-ci-robot added size/L and removed size/M labels Feb 1, 2026
@madhav-murali
Copy link
Author

@serathius, I have added unit test in member_test.go. Is it ok?

@madhav-murali
Copy link
Author

/retest

Copy link
Member

Choose a reason for hiding this comment

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

Test for types.go struct should be in types_test.go


tID := types.ID(raw)
expectedHex := tID.String()
require.JSONEq(t, "\""+expectedHex+"\"", jsonStr)
Copy link
Member

Choose a reason for hiding this comment

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

Please parse it out

Copy link
Author

Choose a reason for hiding this comment

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

(⊙ _ ⊙ ) Forgot the Unmarshaler interface. :S

I've added UnmarshalJSON and included a round-trip test in types_test.go to ensure everything parses back correctly.

@madhav-murali madhav-murali force-pushed the feat/member-id-report-fix branch from 47c401a to 72f0165 Compare February 2, 2026 11:12
@madhav-murali
Copy link
Author

/retest

}
var revision int64
var MemberID uint64
var memberID uint64
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var memberID uint64
var memberID MemberID

memberID = resp.Header.MemberId
}
h.appendSuccessful(request, start, end, putResponseWithMemberID(revision, MemberID))
h.appendSuccessful(request, start, end, putResponseWithMemberID(revision, MemberID(memberID)))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
h.appendSuccessful(request, start, end, putResponseWithMemberID(revision, MemberID(memberID)))
h.appendSuccessful(request, start, end, putResponseWithMemberID(revision, memberID))

return err
}

id, err := types.IDFromString(s)
Copy link
Member

Choose a reason for hiding this comment

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

If we are using IDFromString, for unmarshall we should use symmetrical function during Marshaling. If there is none, we should add it. Expect we should use types.Id(m).String() instead of fmt.Sprintf("%x", m)

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I have corrected the asymmetrical implementations using types.Id(m).String() instead of the current one. I've also use MemberID in types.go for type-safety.
Thanks for the guidance :)

Signed-off-by: Madhav Murali <mdvmrli@gmail.com>
@madhav-murali madhav-murali force-pushed the feat/member-id-report-fix branch from 72f0165 to d6edb51 Compare February 2, 2026 13:20
@@ -70,7 +70,7 @@ func (h *AppendableHistory) AppendRange(startKey, endKey string, revision, limit
respRevision = resp.Header.Revision
respMemberID = resp.Header.MemberId
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
respMemberID = resp.Header.MemberId
respMemberID = MemberID(resp.Header.MemberId)

respMemberID = resp.Header.MemberId
}
h.appendSuccessful(request, start, end, rangeResponseWithMemberID(resp.Kvs, resp.Count, respRevision, respMemberID))
h.appendSuccessful(request, start, end, rangeResponseWithMemberID(resp.Kvs, resp.Count, respRevision, MemberID(respMemberID)))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
h.appendSuccessful(request, start, end, rangeResponseWithMemberID(resp.Kvs, resp.Count, respRevision, MemberID(respMemberID)))
h.appendSuccessful(request, start, end, rangeResponseWithMemberID(resp.Kvs, resp.Count, respRevision, respMemberID))

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: madhav-murali, serathius

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@madhav-murali
Copy link
Author

/retest

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

Development

Successfully merging this pull request may close these issues.

Make robustness report and its log show consistent member-id

4 participants