storagenode/pieces: Restore lost test case (#2767)
PR https://github.com/storj/storj/pull/2596 applied a refactoring which moved tests in of the storagenodb package and it lost a test having replacing the one lost by another one which belonged to another package. This commit removes the duplicated test and restores the lost one.
This commit is contained in:
parent
ce5c45b33c
commit
89a8d32733
@ -18,7 +18,6 @@ import (
|
||||
"storj.io/storj/pkg/signing"
|
||||
"storj.io/storj/pkg/storj"
|
||||
"storj.io/storj/storagenode"
|
||||
"storj.io/storj/storagenode/orders"
|
||||
"storj.io/storj/storagenode/pieces"
|
||||
"storj.io/storj/storagenode/storagenodedb/storagenodedbtest"
|
||||
)
|
||||
@ -172,46 +171,43 @@ func TestV0PieceInfo(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestPieceInfo_Trivial(t *testing.T) {
|
||||
func TestPieceinfo_Trivial(t *testing.T) {
|
||||
storagenodedbtest.Run(t, func(t *testing.T, db storagenode.DB) {
|
||||
ctx := testcontext.New(t)
|
||||
defer ctx.Cleanup()
|
||||
|
||||
satelliteID, serial := testrand.NodeID(), testrand.SerialNumber()
|
||||
pieceinfos := db.V0PieceInfo().(pieces.V0PieceInfoDBForTest)
|
||||
satelliteID, pieceID := testrand.NodeID(), testrand.PieceID()
|
||||
|
||||
{ // Ensure Enqueue works at all
|
||||
err := db.Orders().Enqueue(ctx, &orders.Info{
|
||||
Order: &pb.Order{},
|
||||
Limit: &pb.OrderLimit{
|
||||
SatelliteId: satelliteID,
|
||||
SerialNumber: serial,
|
||||
OrderExpiration: time.Now(),
|
||||
},
|
||||
{ // Ensure Add works at all
|
||||
err := pieceinfos.Add(ctx, &pieces.Info{
|
||||
SatelliteID: satelliteID,
|
||||
PieceID: pieceID,
|
||||
PieceCreation: time.Now(),
|
||||
PieceExpiration: time.Now(),
|
||||
OrderLimit: &pb.OrderLimit{},
|
||||
UplinkPieceHash: &pb.PieceHash{},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
{ // Ensure ListUnsent works at all
|
||||
_, err := db.Orders().ListUnsent(ctx, 1)
|
||||
{ // Ensure Get works at all
|
||||
_, err := pieceinfos.Get(ctx, satelliteID, pieceID)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
{ // Ensure ListUnsentBySatellite works at all
|
||||
_, err := db.Orders().ListUnsentBySatellite(ctx)
|
||||
{ // Ensure DeleteFailed works at all
|
||||
err := pieceinfos.DeleteFailed(ctx, satelliteID, pieceID, time.Now())
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
{ // Ensure Archive works at all
|
||||
err := db.Orders().Archive(ctx, orders.ArchiveRequest{
|
||||
Satellite: satelliteID,
|
||||
Serial: serial,
|
||||
Status: orders.StatusAccepted,
|
||||
})
|
||||
{ // Ensure Delete works at all
|
||||
err := pieceinfos.Delete(ctx, satelliteID, pieceID)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
{ // Ensure ListArchived works at all
|
||||
_, err := db.Orders().ListArchived(ctx, 1)
|
||||
{ // Ensure GetExpired works at all
|
||||
_, err := pieceinfos.GetExpired(ctx, time.Now(), 1)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user