Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ipld): integration test for namespace hasher #1256

Merged

Conversation

distractedm1nd
Copy link
Member

Closes #1249

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2022

Codecov Report

Merging #1256 (eed5a34) into main (a1ca665) will decrease coverage by 0.41%.
The diff coverage is 70.58%.

@@            Coverage Diff             @@
##             main    #1256      +/-   ##
==========================================
- Coverage   56.16%   55.74%   -0.42%     
==========================================
  Files         161      163       +2     
  Lines        9880    10027     +147     
==========================================
+ Hits         5549     5590      +41     
- Misses       3781     3880      +99     
- Partials      550      557       +7     
Impacted Files Coverage Δ
share/availability/light/testing.go 80.95% <60.00%> (ø)
share/availability/test/corrupt_data.go 66.66% <66.66%> (ø)
share/availability/test/testing.go 81.01% <85.71%> (+13.62%) ⬆️
share/availability/full/testing.go 100.00% <100.00%> (+23.52%) ⬆️
nodebuilder/p2p/flags.go 48.68% <0.00%> (-10.58%) ⬇️
header/core/listener.go 52.83% <0.00%> (-5.67%) ⬇️
cmd/celestia/full.go 36.76% <0.00%> (-3.56%) ⬇️
cmd/celestia/light.go 36.23% <0.00%> (-3.46%) ⬇️
nodebuilder/settings.go 0.00% <0.00%> (-3.34%) ⬇️
cmd/celestia/bridge.go 74.13% <0.00%> (-2.79%) ⬇️
... and 52 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

share/availability/test/testing.go Outdated Show resolved Hide resolved
share/ipld/nmt_hasher_integration_test.go Outdated Show resolved Hide resolved
share/ipld/nmt_hasher_integration_test.go Outdated Show resolved Hide resolved
share/ipld/nmt_hasher_integration_test.go Outdated Show resolved Hide resolved
share/ipld/nmt_hasher_integration_test.go Outdated Show resolved Hide resolved
share/ipld/nmt_hasher_integration_test.go Outdated Show resolved Hide resolved
share/availability/test/testing.go Outdated Show resolved Hide resolved
share/availability/test/testing.go Outdated Show resolved Hide resolved
Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

  • can we call nmt_hasher_test.go and we can just, in the docs for TestNamespaceHasher_CorruptedData, explain that it's an integration test, etc. This will get run as part of unit testing though (unless we put it in swamp tests)

  • another nit, I prefer to have test functions first and all mocks used in those test functions defined below

  • additionally noticed SubNetNode is dangling

share/ipld/nmt_hasher_integration_test.go Outdated Show resolved Hide resolved
share/availability/test/testing.go Show resolved Hide resolved
share/ipld/corrupted_data_test.go Show resolved Hide resolved
share/ipld/corrupted_data_test.go Outdated Show resolved Hide resolved
MSevey
MSevey previously approved these changes Oct 24, 2022
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Wondertan
Wondertan previously approved these changes Oct 26, 2022
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

The test logic is legit. Only leaving some nits here

share/availability/test/corrupt_data.go Outdated Show resolved Hide resolved
share/availability/test/corrupt_data.go Outdated Show resolved Hide resolved
share/availability/test/corrupt_data.go Show resolved Hide resolved
@distractedm1nd distractedm1nd merged commit 354048a into celestiaorg:main Oct 26, 2022
}

func (b *CorruptBlock) String() string {
return fmt.Sprintf("[Block %s]", b.Cid())
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
return fmt.Sprintf("[Block %s]", b.Cid())
return fmt.Sprintf("[Block %s]", b.Cid().String())

Comment on lines +115 to +117
lights1, lights2 := make(
[]*availability_test.TestNode, lightNodes/2),
make([]*availability_test.TestNode, lightNodes/2)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Personally for me it is much harder to read code as 3 line like that than if it was 2 lines:

Suggested change
lights1, lights2 := make(
[]*availability_test.TestNode, lightNodes/2),
make([]*availability_test.TestNode, lightNodes/2)
lights1 := make([]*availability_test.TestNode, lightNodes/2)
lights2 := make([]*availability_test.TestNode, lightNodes/2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:ipld IPLD plugin
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

testing: Integration testing for nmtHasher
6 participants