Skip to content

Commit

Permalink
Remove unneeded sleep from txcommon test
Browse files Browse the repository at this point in the history
Fixes hyperledger#618

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
  • Loading branch information
awrichar committed Aug 9, 2022
1 parent e22d84a commit d5aefc4
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions internal/txcommon/txcommon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"testing"
"time"

"github.com/hyperledger/firefly-common/pkg/config"
"github.com/hyperledger/firefly-common/pkg/fftypes"
Expand Down Expand Up @@ -376,7 +375,7 @@ func TestGetTransactionByIDCached(t *testing.T) {

mdi := &databasemocks.Plugin{}
mdm := &datamocks.Manager{}
txHelper, txCache, _ := NewTestTransactionHelper(mdi, mdm)
txHelper, _, _ := NewTestTransactionHelper(mdi, mdm)
ctx := context.Background()

txid := fftypes.NewUUID()
Expand All @@ -388,16 +387,10 @@ func TestGetTransactionByIDCached(t *testing.T) {
BlockchainIDs: core.FFStringArray{"0x111111"},
}, nil).Once()

previousTxCacheSize := txCache.ItemCount()

tx, err := txHelper.GetTransactionByIDCached(ctx, txid)
assert.NoError(t, err)
assert.Equal(t, txid, tx.ID)

for txCache.ItemCount() <= previousTxCacheSize {
time.Sleep(time.Millisecond * 1)
}

tx, err = txHelper.GetTransactionByIDCached(ctx, txid)
assert.NoError(t, err)
assert.Equal(t, txid, tx.ID)
Expand Down

0 comments on commit d5aefc4

Please sign in to comment.