satellite/metabase: rename BeginObjectExactVersion method
With the upcoming versioning changes `BeginObjectExactVersion` makes only sense for testing. Currently this does not rename the options struct or move it into `metabasetest`, because it would create a significant amount of merge/rebase noise. Change-Id: Iafa2f81a05ae66320bc6a839828217ec94c63e1f
This commit is contained in:
parent
bec981aa7a
commit
c6436e1500
@ -136,7 +136,7 @@ func (s *expiredScenario) run(ctx *testcontext.Context, b *testing.B, db *metaba
|
|||||||
StreamID: testrand.UUID(),
|
StreamID: testrand.UUID(),
|
||||||
}
|
}
|
||||||
s.objectStream = append(s.objectStream, objectStream)
|
s.objectStream = append(s.objectStream, objectStream)
|
||||||
_, err := db.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
_, err := db.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
||||||
ObjectStream: objectStream,
|
ObjectStream: objectStream,
|
||||||
Encryption: storj.EncryptionParameters{
|
Encryption: storj.EncryptionParameters{
|
||||||
CipherSuite: storj.EncAESGCM,
|
CipherSuite: storj.EncAESGCM,
|
||||||
|
@ -119,7 +119,7 @@ func (s *scenario) run(ctx *testcontext.Context, b *testing.B, db *metabase.DB)
|
|||||||
|
|
||||||
totalUpload.Record(func() {
|
totalUpload.Record(func() {
|
||||||
beginObject.Record(func() {
|
beginObject.Record(func() {
|
||||||
_, err := db.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
_, err := db.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
||||||
ObjectStream: objectStream,
|
ObjectStream: objectStream,
|
||||||
Encryption: storj.EncryptionParameters{
|
Encryption: storj.EncryptionParameters{
|
||||||
CipherSuite: storj.EncAESGCM,
|
CipherSuite: storj.EncAESGCM,
|
||||||
|
@ -191,8 +191,8 @@ func (opts *BeginObjectExactVersion) Verify() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// BeginObjectExactVersion adds a pending object to the database, with specific version.
|
// TestingBeginObjectExactVersion adds a pending object to the database, with specific version.
|
||||||
func (db *DB) BeginObjectExactVersion(ctx context.Context, opts BeginObjectExactVersion) (committed Object, err error) {
|
func (db *DB) TestingBeginObjectExactVersion(ctx context.Context, opts BeginObjectExactVersion) (committed Object, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
if err := opts.Verify(); err != nil {
|
if err := opts.Verify(); err != nil {
|
||||||
|
@ -457,7 +457,7 @@ func TestDeleteZombieObjects(t *testing.T) {
|
|||||||
t.Run("migrated objects", func(t *testing.T) {
|
t.Run("migrated objects", func(t *testing.T) {
|
||||||
defer metabasetest.DeleteAll{}.Check(ctx, t, db)
|
defer metabasetest.DeleteAll{}.Check(ctx, t, db)
|
||||||
|
|
||||||
_, err := db.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
_, err := db.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
||||||
ObjectStream: obj1,
|
ObjectStream: obj1,
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -267,7 +267,7 @@ func (co CreateTestObject) Run(ctx *testcontext.Context, t testing.TB, db *metab
|
|||||||
boeOpts = *co.BeginObjectExactVersion
|
boeOpts = *co.BeginObjectExactVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
object, err := db.BeginObjectExactVersion(ctx, boeOpts)
|
object, err := db.TestingBeginObjectExactVersion(ctx, boeOpts)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
createdSegments := []metabase.Segment{}
|
createdSegments := []metabase.Segment{}
|
||||||
|
@ -65,7 +65,7 @@ type BeginObjectExactVersion struct {
|
|||||||
|
|
||||||
// Check runs the test.
|
// Check runs the test.
|
||||||
func (step BeginObjectExactVersion) Check(ctx *testcontext.Context, t require.TestingT, db *metabase.DB) {
|
func (step BeginObjectExactVersion) Check(ctx *testcontext.Context, t require.TestingT, db *metabase.DB) {
|
||||||
got, err := db.BeginObjectExactVersion(ctx, step.Opts)
|
got, err := db.TestingBeginObjectExactVersion(ctx, step.Opts)
|
||||||
checkError(t, err, step.ErrClass, step.ErrText)
|
checkError(t, err, step.ErrClass, step.ErrText)
|
||||||
if step.ErrClass == nil {
|
if step.ErrClass == nil {
|
||||||
require.Equal(t, step.Opts.Version, got.Version)
|
require.Equal(t, step.Opts.Version, got.Version)
|
||||||
|
@ -508,7 +508,7 @@ func insertSegment(ctx context.Context, t *testing.T, planet *testplanet.Planet,
|
|||||||
StreamID: testrand.UUID(),
|
StreamID: testrand.UUID(),
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := metabaseDB.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
_, err := metabaseDB.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{
|
||||||
ObjectStream: obj,
|
ObjectStream: obj,
|
||||||
Encryption: storj.EncryptionParameters{
|
Encryption: storj.EncryptionParameters{
|
||||||
CipherSuite: storj.EncAESGCM,
|
CipherSuite: storj.EncAESGCM,
|
||||||
|
Loading…
Reference in New Issue
Block a user