Skip to content

Commit

Permalink
itest: don't return error from AssertXXX function
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Oct 5, 2023
1 parent 1387d95 commit b9a4b0e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
8 changes: 4 additions & 4 deletions itest/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,13 +990,15 @@ func AssertUniverseRootEquality(t *testing.T,
))
}

// AssertUniverseRoot makes sure the given universe root exists with the given
// sum, either identified by the asset ID or group key.
func AssertUniverseRoot(t *testing.T, client unirpc.UniverseClient,
sum int, assetID []byte, groupKey []byte) error {
sum int, assetID []byte, groupKey []byte) {

bothSet := assetID != nil && groupKey != nil
neitherSet := assetID == nil && groupKey == nil
if bothSet || neitherSet {
return fmt.Errorf("only set one of assetID or groupKey")
t.Fatalf("only set one of assetID or groupKey")
}

// Re-parse and serialize the keys to account for the different
Expand Down Expand Up @@ -1033,8 +1035,6 @@ func AssertUniverseRoot(t *testing.T, client unirpc.UniverseClient,

correctRoot := fn.Any(maps.Values(uniRoots.UniverseRoots), matchingRoot)
require.True(t, correctRoot)

return nil
}

func AssertUniverseRootEqual(a, b *unirpc.UniverseRoot) bool {
Expand Down
8 changes: 2 additions & 6 deletions itest/loadtest/mint_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package loadtest

import (
"context"
_ "embed"
"encoding/binary"
"encoding/hex"
"fmt"
Expand All @@ -10,8 +11,6 @@ import (
"testing"
"time"

_ "embed"

"github.com/btcsuite/btcd/rpcclient"
"github.com/lightninglabs/taproot-assets/fn"
"github.com/lightninglabs/taproot-assets/itest"
Expand Down Expand Up @@ -161,10 +160,7 @@ func mintBatchStressTest(t *testing.T, ctx context.Context,
require.NoError(t, err)
require.Len(t, uniRoots.UniverseRoots, groupCount)

err = itest.AssertUniverseRoot(
t, alice, groupBalance, nil, collectGroupKey,
)
require.NoError(t, err)
itest.AssertUniverseRoot(t, alice, groupBalance, nil, collectGroupKey)

// The universe tree should also have a leaf for each asset minted.
// TODO(jhb): Resolve issue of 33-byte group key handling.
Expand Down
5 changes: 1 addition & 4 deletions itest/mint_batch_stress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,7 @@ func mintBatchStressTest(
require.NoError(t, err)
require.Len(t, uniRoots.UniverseRoots, groupCount)

err = AssertUniverseRoot(
t, alice, groupBalance, nil, collectGroupKey,
)
require.NoError(t, err)
AssertUniverseRoot(t, alice, groupBalance, nil, collectGroupKey)

// The universe tree should also have a leaf for each asset minted.
// TODO(jhb): Resolve issue of 33-byte group key handling.
Expand Down

0 comments on commit b9a4b0e

Please sign in to comment.