Skip to content

test: add metadata and metadataKey test coverage#1247

Merged
rwalworth merged 2 commits intohiero-ledger:mainfrom
Kubikusik:setMetadataUnitTests
Mar 18, 2026
Merged

test: add metadata and metadataKey test coverage#1247
rwalworth merged 2 commits intohiero-ledger:mainfrom
Kubikusik:setMetadataUnitTests

Conversation

@Kubikusik
Copy link
Copy Markdown
Contributor

Description:
Cover test coverage gap for setMetadata and setMetadataKey in
TokenUpdateTransactionUnitTests.cc to match the pattern of all other setters.

  • Add mTestMetadataKey private member and getTestMetadataKey() accessor to test fixture
  • Add GetSetMetadataFrozen test
  • Add GetSetMetadataKey and GetSetMetadataKeyFrozen tests
  • Extend ConstructTokenUpdateTransactionFromTransactionBodyProtobuf to set and
    verify metadata and metadata_key fields

Related issue(s):
Fixes #1235

Notes for reviewer:
Current implementation involves a helper function for setting body->set_allocated_metadata in the TokenUpdateTransactionBody protobuf, if there is a more intended solution I have missed, please do propose it as a change here.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

…tTests

Signed-off-by: kubikusik <jakubmical@student.agh.edu.pl>
@Kubikusik Kubikusik force-pushed the setMetadataUnitTests branch from 5e8fbec to 69946c2 Compare March 17, 2026 18:56
@Kubikusik Kubikusik marked this pull request as ready for review March 17, 2026 18:57
@Kubikusik Kubikusik requested review from a team as code owners March 17, 2026 18:57
@Kubikusik Kubikusik requested a review from rwalworth March 17, 2026 18:57
@github-actions
Copy link
Copy Markdown

Hey @Kubikusik 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

DCO Sign-off -- All commits have valid sign-offs. Nice work!


GPG Signature -- All commits have verified GPG signatures. Locked and loaded!


Merge Conflicts -- No merge conflicts detected. Smooth sailing!


Issue Link -- Linked to #1235 (assigned to you).


🎉 All checks passed! Your PR is ready for review. Great job!

@github-actions github-actions bot added the status: needs review The pull request is ready for maintainer review label Mar 17, 2026
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this @Kubikusik! The test coverage additions are on the right track - the new GetSetMetadataFrozen, GetSetMetadataKey, and GetSetMetadataKeyFrozen tests and the protobuf deserialization assertions are exactly what #1235 asks for.

I left a few comments below. To answer your question from the PR description - there is a simpler way to set the metadata field on the protobuf body that avoids the helper function entirely. Details in the comment below!

@rwalworth rwalworth added status: needs revision A pull request that requires changes before merge and removed status: needs review The pull request is ready for maintainer review labels Mar 17, 2026
Signed-off-by: kubikusik <jakubmical@student.agh.edu.pl>
@github-actions github-actions bot added status: needs review The pull request is ready for maintainer review and removed status: needs revision A pull request that requires changes before merge labels Mar 17, 2026
@Kubikusik Kubikusik requested a review from rwalworth March 17, 2026 21:47
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @Kubikusik - all three items from my previous review are addressed. The bytesToProtobuf helper is gone, GetSetMetadataKey matches the non-frozen pattern, and the trailing newline is back. Running the workflows now and will merge once they pass!

@rwalworth rwalworth merged commit 50062bc into hiero-ledger:main Mar 18, 2026
11 checks passed
@rwalworth rwalworth removed the status: needs review The pull request is ready for maintainer review label Mar 18, 2026
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.

[Beginner]: Add missing unit tests for setMetadataKey and frozen setMetadata in TokenUpdateTransactionUnitTests

2 participants