Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet committed Aug 25, 2024
1 parent ac448fd commit 1a4f687
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions protocol/rpcconsumer/relay_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func sendSuccessResp(relayProcessor *RelayProcessor, provider string, delay time
RelaySession: &pairingtypes.RelaySession{},
RelayData: &pairingtypes.RelayPrivateData{},
},
Reply: &pairingtypes.RelayReply{Data: []byte("ok")},
Reply: &pairingtypes.RelayReply{Data: []byte("ok"), LatestBlock: 1},
ProviderInfo: common.ProviderInfo{ProviderAddress: provider},
StatusCode: http.StatusOK,
},
Expand Down Expand Up @@ -133,9 +133,18 @@ func TestRelayProcessorHappyFlow(t *testing.T) {
returnedResult, err := relayProcessor.ProcessingResult()
require.NoError(t, err)
require.Equal(t, string(returnedResult.Reply.Data), "ok")

seenBlock, found := consistency.GetSeenBlock(protocolMessage.GetUserData().DappId, protocolMessage.GetUserData().ConsumerIp)
fmt.Println(seenBlock, found)
var seenBlock int64
var found bool
// wait for cache to be added asynchronously
for i := 0; i < 10; i++ {
seenBlock, found = consistency.GetSeenBlock(protocolMessage.GetUserData().DappId, protocolMessage.GetUserData().ConsumerIp)
if found {
break
}
time.Sleep(10 * time.Millisecond)
}
require.True(t, found)
require.Equal(t, seenBlock, int64(1))
})
}

Expand Down

0 comments on commit 1a4f687

Please sign in to comment.