Skip to content

Commit

Permalink
add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Jun 7, 2024
1 parent 3fb79c5 commit 3520ee4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions api/subscriptions/subscriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/gorilla/mux"
"github.com/gorilla/websocket"
"github.com/inconshreveable/log15"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/vechain/thor/v2/block"
Expand All @@ -33,6 +34,7 @@ var repo *chain.Repository
var blocks []*block.Block

func TestSubscriptions(t *testing.T) {
log.SetHandler(log15.LvlFilterHandler(log15.LvlDebug, log15.StdoutHandler))
initSubscriptionsServer(t)
defer ts.Close()

Expand Down Expand Up @@ -75,19 +77,19 @@ func testHandlePendingTransactions(t *testing.T) {
transaction := createTx(t, repo, 1)
assert.NoError(t, txPool.AddLocal(transaction))

var wsNotif bool
var mempoolNotif, wsNotif bool
var msg []byte
for {
select {
//case <-txChan:
// mempoolNotif = true
case <-txChan:
mempoolNotif = true
case rcvMsg := <-wsChan:
msg = rcvMsg
wsNotif = true
case <-time.After(5 * time.Second):
t.Fatal("message not received in time")
}
if wsNotif {
if wsNotif && mempoolNotif {
break
}
}
Expand Down

0 comments on commit 3520ee4

Please sign in to comment.