forked from TrueCloudLab/frostfs-node
[#xx] Avoid manual management of files in tests
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
376f03a445
commit
ae8be495c8
13 changed files with 17 additions and 79 deletions
|
@ -44,18 +44,12 @@ func TestInitializationFailure(t *testing.T) {
|
|||
sid, err := generateShardID()
|
||||
require.NoError(t, err)
|
||||
|
||||
tempDir := t.TempDir()
|
||||
blobstorPath := filepath.Join(tempDir, "bs")
|
||||
metabasePath := filepath.Join(tempDir, "mb")
|
||||
writecachePath := filepath.Join(tempDir, "wc")
|
||||
piloramaPath := filepath.Join(tempDir, "pl")
|
||||
|
||||
storages, smallFileStorage, largeFileStorage := newTestStorages(blobstorPath, 1<<20)
|
||||
storages, smallFileStorage, largeFileStorage := newTestStorages(t.TempDir(), 1<<20)
|
||||
|
||||
wcOpts := writecacheconfig.Options{
|
||||
Type: writecacheconfig.TypeBBolt,
|
||||
BBoltOptions: []writecachebbolt.Option{
|
||||
writecachebbolt.WithPath(writecachePath),
|
||||
writecachebbolt.WithPath(t.TempDir()),
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -69,13 +63,13 @@ func TestInitializationFailure(t *testing.T) {
|
|||
Timeout: 100 * time.Millisecond,
|
||||
OpenFile: opts.openFileMetabase,
|
||||
}),
|
||||
meta.WithPath(metabasePath),
|
||||
meta.WithPath(filepath.Join(t.TempDir(), "metabase")),
|
||||
meta.WithPermissions(0700),
|
||||
meta.WithEpochState(epochState{})),
|
||||
shard.WithWriteCache(true),
|
||||
shard.WithWriteCacheOptions(wcOpts),
|
||||
shard.WithPiloramaOptions(
|
||||
pilorama.WithPath(piloramaPath),
|
||||
pilorama.WithPath(filepath.Join(t.TempDir(), "pilorama")),
|
||||
pilorama.WithOpenFile(opts.openFilePilorama),
|
||||
),
|
||||
}, smallFileStorage, largeFileStorage
|
||||
|
@ -178,10 +172,6 @@ func testEngineFailInitAndReload(t *testing.T, errOnAdd bool, opts []shard.Optio
|
|||
func TestExecBlocks(t *testing.T) {
|
||||
e := testNewEngine(t).setShardsNum(t, 2).engine // number doesn't matter in this test, 2 is several but not many
|
||||
|
||||
t.Cleanup(func() {
|
||||
os.RemoveAll(t.Name())
|
||||
})
|
||||
|
||||
// put some object
|
||||
obj := testutil.GenerateObjectWithCID(cidtest.ID())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue