storagenode/piecestore: fix TestUpload

The test needs to wait for the upload information to be saved to the
database.

Fixes https://github.com/storj/storj/issues/6008

Change-Id: I1f258c923a4b33cbc571f97bad046cec70642a0b
This commit is contained in:
Egon Elbre 2023-06-29 20:52:04 +03:00
parent 0ca7d19fc7
commit 2463b881c6

View File

@ -72,6 +72,8 @@ func TestUploadAndPartialDownload(t *testing.T) {
}() }()
} }
require.NoError(t, planet.WaitForStorageNodeEndpoints(ctx))
var totalBandwidthUsage bandwidth.Usage var totalBandwidthUsage bandwidth.Usage
for _, storagenode := range planet.StorageNodes { for _, storagenode := range planet.StorageNodes {
usage, err := storagenode.DB.Bandwidth().Summary(ctx, time.Now().Add(-10*time.Hour), time.Now().Add(10*time.Hour)) usage, err := storagenode.DB.Bandwidth().Summary(ctx, time.Now().Add(-10*time.Hour), time.Now().Add(10*time.Hour))
@ -191,6 +193,8 @@ func TestUpload(t *testing.T) {
} }
} }
require.NoError(t, planet.WaitForStorageNodeEndpoints(ctx))
from, to := date.MonthBoundary(time.Now().UTC()) from, to := date.MonthBoundary(time.Now().UTC())
summary, err := planet.StorageNodes[0].DB.Bandwidth().SatelliteIngressSummary(ctx, planet.Satellites[0].ID(), from, to) summary, err := planet.StorageNodes[0].DB.Bandwidth().SatelliteIngressSummary(ctx, planet.Satellites[0].ID(), from, to)
require.NoError(t, err) require.NoError(t, err)