Commit 1be2687d authored by Janoš Guljaš's avatar Janoš Guljaš Committed by GitHub

fix(pusher): flaky test (#1800)

parent 5ddd07f5
......@@ -89,6 +89,7 @@ func TestSendChunkToSyncWithTag(t *testing.T) {
mtags, p, storer := createPusher(t, triggerPeer, pushSyncService, mock.WithClosestPeer(closestPeer))
defer storer.Close()
defer p.Close()
ta, err := mtags.Create(1)
if err != nil {
......@@ -119,8 +120,6 @@ func TestSendChunkToSyncWithTag(t *testing.T) {
if ta.Get(tags.StateSynced) != 1 {
t.Fatalf("tags error")
}
p.Close()
}
// TestSendChunkToPushSyncWithoutTag is similar to TestSendChunkToPushSync, excep that the tags are not
......@@ -146,6 +145,7 @@ func TestSendChunkToPushSyncWithoutTag(t *testing.T) {
_, p, storer := createPusher(t, triggerPeer, pushSyncService, mock.WithClosestPeer(closestPeer))
defer storer.Close()
defer p.Close()
_, err := storer.Put(context.Background(), storage.ModePutUpload, chunk)
if err != nil {
......@@ -155,7 +155,7 @@ func TestSendChunkToPushSyncWithoutTag(t *testing.T) {
// Check is the chunk is set as synced in the DB.
for i := 0; i < noOfRetries; i++ {
// Give some time for chunk to be pushed and receipt to be received
time.Sleep(10 * time.Millisecond)
time.Sleep(50 * time.Millisecond)
err = checkIfModeSet(chunk.Address(), storage.ModeSetSync, storer)
if err == nil {
......@@ -165,7 +165,6 @@ func TestSendChunkToPushSyncWithoutTag(t *testing.T) {
if err != nil {
t.Fatal(err)
}
p.Close()
}
// TestSendChunkAndReceiveInvalidReceipt sends a chunk to pushsync to be sent ot its closest peer and
......@@ -184,6 +183,7 @@ func TestSendChunkAndReceiveInvalidReceipt(t *testing.T) {
_, p, storer := createPusher(t, triggerPeer, pushSyncService, mock.WithClosestPeer(closestPeer))
defer storer.Close()
defer p.Close()
_, err := storer.Put(context.Background(), storage.ModePutUpload, chunk)
if err != nil {
......@@ -203,7 +203,6 @@ func TestSendChunkAndReceiveInvalidReceipt(t *testing.T) {
if err == nil {
t.Fatalf("chunk not syned error expected")
}
p.Close()
}
// TestSendChunkAndTimeoutinReceivingReceipt sends a chunk to pushsync to be sent ot its closest peer and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment