diff --git a/cmd/storagenode/cmd_forget_satellite.go b/cmd/storagenode/cmd_forget_satellite.go index 73f419106..c7eb1d906 100644 --- a/cmd/storagenode/cmd_forget_satellite.go +++ b/cmd/storagenode/cmd_forget_satellite.go @@ -91,6 +91,7 @@ func cmdForgetSatellite(ctx context.Context, log *zap.Logger, cfg *forgetSatelli if err != nil { return errs.New("Error starting master database on storagenode: %+v", err) } + defer func() { err = errs.Combine(err, db.Close()) }() satelliteDB := db.Satellites() diff --git a/cmd/storagenode/cmd_forget_satellite_test.go b/cmd/storagenode/cmd_forget_satellite_test.go index 8a8397ee1..12880a9ec 100644 --- a/cmd/storagenode/cmd_forget_satellite_test.go +++ b/cmd/storagenode/cmd_forget_satellite_test.go @@ -61,6 +61,8 @@ func Test_newForgetSatelliteCmd_Error(t *testing.T) { } func Test_cmdForgetSatellite(t *testing.T) { + t.Skip("The tests and the behavior is currently flaky. See https://github.com/storj/storj/issues/6465") + testplanet.Run(t, testplanet.Config{ SatelliteCount: 2, StorageNodeCount: 1, UplinkCount: 0, }, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) { @@ -70,6 +72,7 @@ func Test_cmdForgetSatellite(t *testing.T) { store, err := filestore.NewAt(log, db.Config().Pieces, filestore.DefaultConfig) require.NoError(t, err) + defer ctx.Check(store.Close) satelliteID := planet.Satellites[0].ID() @@ -137,6 +140,12 @@ func Test_cmdForgetSatellite(t *testing.T) { }) require.NoError(t, err) + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // TODO: this is for reproducing the bug, + // remove it once it's fixed. + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + time.Sleep(10 * time.Second) + // check that the blob was deleted blobInfo, err := store.Stat(ctx, blobRef) require.Error(t, err) @@ -154,6 +163,8 @@ func Test_cmdForgetSatellite(t *testing.T) { } func Test_cmdForgetSatellite_Exclusions(t *testing.T) { + t.Skip("The tests and the behavior is currently flaky. See https://github.com/storj/storj/issues/6465") + testplanet.Run(t, testplanet.Config{ SatelliteCount: 2, StorageNodeCount: 1, UplinkCount: 0, }, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) { @@ -163,6 +174,7 @@ func Test_cmdForgetSatellite_Exclusions(t *testing.T) { store, err := filestore.NewAt(log, db.Config().Pieces, filestore.DefaultConfig) require.NoError(t, err) + defer ctx.Check(store.Close) satelliteID := planet.Satellites[0].ID() diff --git a/storagenode/pieces/cache_test.go b/storagenode/pieces/cache_test.go index 178878300..1b51254c3 100644 --- a/storagenode/pieces/cache_test.go +++ b/storagenode/pieces/cache_test.go @@ -199,6 +199,7 @@ func TestCacheServiceRun(t *testing.T) { store, err := filestore.NewAt(log, db.Config().Pieces, filestore.DefaultConfig) require.NoError(t, err) + defer ctx.Check(store.Close) // Prior to initializing the cache service (which should walk the files), // write a single file so something exists to be counted @@ -279,6 +280,7 @@ func TestCacheServiceRun_LazyFilewalker(t *testing.T) { store, err := filestore.NewAt(log, dbConfig.Pieces, dbConfig.Filestore) require.NoError(t, err) + defer ctx.Check(store.Close) // Prior to initializing the cache service (which should walk the files), // write a single file so something exists to be counted