forked from TrueCloudLab/frostfs-node
WIP: Morph: Add unit tests #2
5 changed files with 25 additions and 1 deletions
|
@ -18,6 +18,8 @@ import (
|
|||
)
|
||||
|
||||
func TestDeleteBigObject(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
defer os.RemoveAll(t.Name())
|
||||
|
||||
cnr := cidtest.ID()
|
||||
|
|
|
@ -77,6 +77,8 @@ func newEngineEvacuate(t *testing.T, shardNum int, objPerShard int) (*StorageEng
|
|||
}
|
||||
|
||||
func TestEvacuateShard(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const objPerShard = 3
|
||||
|
||||
e, ids, objects := newEngineEvacuate(t, 3, objPerShard)
|
||||
|
@ -132,6 +134,8 @@ func TestEvacuateShard(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEvacuateNetwork(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var errReplication = errors.New("handler error")
|
||||
|
||||
acceptOneOf := func(objects []*objectSDK.Object, max int) func(context.Context, oid.Address, *objectSDK.Object) error {
|
||||
|
@ -154,6 +158,7 @@ func TestEvacuateNetwork(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run("single shard", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
e, ids, objects := newEngineEvacuate(t, 1, 3)
|
||||
evacuateShardID := ids[0].String()
|
||||
|
||||
|
@ -173,6 +178,7 @@ func TestEvacuateNetwork(t *testing.T) {
|
|||
require.Equal(t, 2, res.Count())
|
||||
})
|
||||
t.Run("multiple shards, evacuate one", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
e, ids, objects := newEngineEvacuate(t, 2, 3)
|
||||
|
||||
require.NoError(t, e.shards[ids[0].String()].SetMode(mode.ReadOnly))
|
||||
|
@ -195,6 +201,7 @@ func TestEvacuateNetwork(t *testing.T) {
|
|||
})
|
||||
})
|
||||
t.Run("multiple shards, evacuate many", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
e, ids, objects := newEngineEvacuate(t, 4, 5)
|
||||
evacuateIDs := ids[0:3]
|
||||
|
||||
|
@ -229,6 +236,7 @@ func TestEvacuateNetwork(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEvacuateCancellation(t *testing.T) {
|
||||
t.Parallel()
|
||||
e, ids, _ := newEngineEvacuate(t, 2, 3)
|
||||
|
||||
require.NoError(t, e.shards[ids[0].String()].SetMode(mode.ReadOnly))
|
||||
|
|
|
@ -29,6 +29,8 @@ func sortAddresses(addrWithType []object.AddressWithType) []object.AddressWithTy
|
|||
}
|
||||
|
||||
func TestListWithCursor(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
shardNum int
|
||||
|
@ -60,8 +62,10 @@ func TestListWithCursor(t *testing.T) {
|
|||
batchSize: 100,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
for i := range tests {
|
||||
tt := tests[i]
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
e := testNewEngine(t).setShardsNumOpts(t, tt.shardNum, func(id int) []shard.Option {
|
||||
return []shard.Option{
|
||||
shard.WithLogger(&logger.Logger{Logger: zap.L()}),
|
||||
|
|
|
@ -31,6 +31,8 @@ func (t tss) IsTombstoneAvailable(ctx context.Context, _ oid.Address, epoch uint
|
|||
}
|
||||
|
||||
func TestLockUserScenario(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Tested user actions:
|
||||
// 1. stores some object
|
||||
// 2. locks the object
|
||||
|
@ -146,6 +148,8 @@ func TestLockUserScenario(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLockExpiration(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Tested scenario:
|
||||
// 1. some object is stored
|
||||
// 2. lock object for it is stored, and the object is locked
|
||||
|
@ -222,6 +226,8 @@ func TestLockExpiration(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLockForceRemoval(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Tested scenario:
|
||||
// 1. some object is stored
|
||||
// 2. lock object for it is stored, and the object is locked
|
||||
|
|
|
@ -17,6 +17,8 @@ import (
|
|||
)
|
||||
|
||||
func TestRebalance(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
te := newEngineWithErrorThreshold(t, "", 0)
|
||||
|
||||
const (
|
||||
|
@ -101,6 +103,8 @@ loop:
|
|||
}
|
||||
|
||||
func TestRebalanceSingleThread(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
te := newEngineWithErrorThreshold(t, "", 0)
|
||||
|
||||
obj := testutil.GenerateObjectWithCID(cidtest.ID())
|
||||
|
|
Loading…
Reference in a new issue