Skip to content

test: add HbarAllowance unit coverage#1708

Merged
Dosik13 merged 2 commits into
hiero-ledger:mainfrom
peter941221:issue/hiero-sdk-go-1705
May 15, 2026
Merged

test: add HbarAllowance unit coverage#1708
Dosik13 merged 2 commits into
hiero-ledger:mainfrom
peter941221:issue/hiero-sdk-go-1705

Conversation

@peter941221

@peter941221 peter941221 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add unit coverage for HbarAllowance constructor storage
  • add protobuf round-trip coverage, including nil owner and nil spender cases
  • add String() coverage for all four owner/spender nil combinations

Validation

  • GOPROXY=https://goproxy.cn,direct go test ./sdk -tags="unit" -v -run TestUnitHbarAllowance -timeout 9999s
  • GOPROXY=https://goproxy.cn,direct go build ./...
  • GOPROXY=https://goproxy.cn,direct golangci-lint run

Notes

  • go test ./sdk -tags="unit" -v -timeout 9999s currently fails in existing TestUnitConcurrentGetNodeReadmit with panic: failed to find a healthy working node.
  • I reproduced that same failure on a clean origin/main mirror, so it is unrelated to this change.

Fixes: #1705

Signed-off-by: peter941221 <peter941221@gmail.com>
@peter941221 peter941221 requested review from a team as code owners May 14, 2026 08:10
@lfdt-bot

lfdt-bot commented May 14, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@Dosik13

Dosik13 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Hi, can you give me more info about this:
go test ./sdk -tags="unit" -v -timeout 9999s currently fails in existing TestUnitConcurrentGetNodeReadmit with panic: failed to find a healthy working node.

@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 2 files with indirect coverage changes

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

@peter941221

Copy link
Copy Markdown
Contributor Author

Sure.

This was a local full-suite observation, not a failure introduced by this PR.

On my local Windows environment:

go version go1.25.7 windows/amd64

I can reproduce the panic by running the existing test directly:

go test ./sdk -tags="unit" -v -run TestUnitConcurrentGetNodeReadmit -count=10 -timeout 9999s

It fails with:

panic: failed to find a healthy working node
sdk/managed_network.go:185
sdk/network_unit_test.go:85

I also reproduced the same failure on a clean origin/main checkout at:

d91f3f2b1938fcd651b43bff9eeed7ca33fe5ec1

so it does not appear to be related to the new HbarAllowance test file.

The PR-specific test passes locally:

go test ./sdk -tags="unit" -v -run TestUnitHbarAllowance -timeout 9999s

Also, I see the GitHub Actions Unit and Integration Tests (unit) job is passing for this PR, so the hosted CI environment does not appear to hit the same local panic.

@Dosik13

Dosik13 commented May 14, 2026

Copy link
Copy Markdown
Contributor

can you raise an issue about this - you could also work on it if you want

@peter941221

Copy link
Copy Markdown
Contributor Author

Opened #1714 to track it separately. I'll keep this PR focused on the HbarAllowance unit coverage.

@Dosik13 Dosik13 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

@Dosik13 Dosik13 merged commit d541325 into hiero-ledger:main May 15, 2026
13 checks passed
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 unit tests for HbarAllowance

3 participants