Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name storage migration, include in error #3198

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions migrations/capcons/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func testPathCapabilityValueMigration(

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

capabilityMapping := &CapabilityMapping{}

Expand Down Expand Up @@ -1298,7 +1298,7 @@ func testLinkMigration(

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

capabilityMapping := &CapabilityMapping{}

Expand Down Expand Up @@ -2007,7 +2007,7 @@ func TestPublishedPathCapabilityValueMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

capabilityMapping := &CapabilityMapping{}

Expand Down Expand Up @@ -2248,7 +2248,7 @@ func TestUntypedPathCapabilityValueMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

capabilityMapping := &CapabilityMapping{}

Expand Down
20 changes: 10 additions & 10 deletions migrations/entitlements/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ func convertEntireTestValue(

reporter := newTestReporter()

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

migratedValue := migration.MigrateNestedValue(
interpreter.StorageKey{
Expand Down Expand Up @@ -1530,7 +1530,7 @@ func TestMigrateSimpleContract(t *testing.T) {

reporter := newTestReporter()

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")
migration.MigrateAccount(
account,
migration.NewValueMigrationsPathMigrator(
Expand Down Expand Up @@ -1713,7 +1713,7 @@ func TestMigratePublishedValue(t *testing.T) {
})
require.NoError(t, err)

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")
migration.MigrateAccount(
testAddress,
migration.NewValueMigrationsPathMigrator(
Expand Down Expand Up @@ -1966,7 +1966,7 @@ func TestMigratePublishedValueAcrossTwoAccounts(t *testing.T) {

reporter := newTestReporter()

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")
migrator := migration.NewValueMigrationsPathMigrator(
reporter,
NewEntitlementsMigration(inter),
Expand Down Expand Up @@ -2213,7 +2213,7 @@ func TestMigrateAcrossContracts(t *testing.T) {

reporter := newTestReporter()

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")
migrator := migration.NewValueMigrationsPathMigrator(
reporter,
NewEntitlementsMigration(inter),
Expand Down Expand Up @@ -2416,7 +2416,7 @@ func TestMigrateArrayOfValues(t *testing.T) {

reporter := newTestReporter()

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")
migrator := migration.NewValueMigrationsPathMigrator(
reporter,
NewEntitlementsMigration(inter),
Expand Down Expand Up @@ -2665,7 +2665,7 @@ func TestMigrateDictOfValues(t *testing.T) {

reporter := newTestReporter()

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")
migrator := migration.NewValueMigrationsPathMigrator(
reporter,
NewEntitlementsMigration(inter),
Expand Down Expand Up @@ -2986,7 +2986,7 @@ func TestMigrateCapConsAcrossTwoAccounts(t *testing.T) {

reporter := newTestReporter()

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")
migrator := migration.NewValueMigrationsPathMigrator(
reporter,
NewEntitlementsMigration(inter),
Expand Down Expand Up @@ -3198,7 +3198,7 @@ func TestRehash(t *testing.T) {
return compositeType
}

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -3388,7 +3388,7 @@ func TestIntersectionTypeWithIntersectionLegacyType(t *testing.T) {
}
}

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down
5 changes: 4 additions & 1 deletion migrations/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@
type StorageMigration struct {
storage *runtime.Storage
interpreter *interpreter.Interpreter
name string
}

func NewStorageMigration(
interpreter *interpreter.Interpreter,
storage *runtime.Storage,
name string,
) *StorageMigration {
return &StorageMigration{
storage: storage,
interpreter: interpreter,
name: name,
}
}

Expand Down Expand Up @@ -173,7 +176,7 @@
err = StorageMigrationError{
StorageKey: storageKey,
StorageMapKey: storageMapKey,
Migration: "StorageMigration",
Migration: m.name,

Check warning on line 179 in migrations/migration.go

View check run for this annotation

Codecov / codecov/patch

migrations/migration.go#L179

Added line #L179 was not covered by tests
Err: err,
Stack: debug.Stack(),
}
Expand Down
20 changes: 10 additions & 10 deletions migrations/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ func TestMultipleMigrations(t *testing.T) {

// Migrate

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -647,7 +647,7 @@ func TestMigrationError(t *testing.T) {

// Migrate

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -794,7 +794,7 @@ func TestCapConMigration(t *testing.T) {

reporter := newTestReporter()

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

migration.MigrateAccount(
testAddress,
Expand Down Expand Up @@ -909,7 +909,7 @@ func TestContractMigration(t *testing.T) {

reporter := newTestReporter()

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

migration.MigrateAccount(
testAddress,
Expand Down Expand Up @@ -1102,7 +1102,7 @@ func TestEmptyIntersectionTypeMigration(t *testing.T) {

reporter := newTestReporter()

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

migration.MigrateAccount(
testAddress,
Expand Down Expand Up @@ -1246,7 +1246,7 @@ func TestMigratingNestedContainers(t *testing.T) {

// Migrate

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -1676,7 +1676,7 @@ func TestMigrationPanic(t *testing.T) {

// Migrate

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -1803,7 +1803,7 @@ func TestSkip(t *testing.T) {

// Migrate

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -2143,7 +2143,7 @@ func TestPublishedValueMigration(t *testing.T) {

reporter := newTestReporter()

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

migration.MigrateAccount(
testAddress,
Expand Down Expand Up @@ -2250,7 +2250,7 @@ func TestDomainsMigration(t *testing.T) {

reporter := newTestReporter()

migration := NewStorageMigration(inter, storage)
migration := NewStorageMigration(inter, storage, "test")

migration.MigrateAccount(
testAddress,
Expand Down
8 changes: 4 additions & 4 deletions migrations/statictypes/account_type_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func TestAccountTypeInTypeValueMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -852,7 +852,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -1158,7 +1158,7 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -1298,7 +1298,7 @@ func TestAccountTypeRehash(t *testing.T) {

storage, inter := newStorageAndInterpreter(t)

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down
2 changes: 1 addition & 1 deletion migrations/statictypes/composite_type_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestCompositeAndInterfaceTypeMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down
12 changes: 6 additions & 6 deletions migrations/statictypes/intersection_type_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func TestIntersectionTypeMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -566,7 +566,7 @@ func TestIntersectionTypeRehash(t *testing.T) {

storage, inter := newStorageAndInterpreter(t)

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -733,7 +733,7 @@ func TestRehashNestedIntersectionType(t *testing.T) {

storage, inter := newStorageAndInterpreter(t, ledger)

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -875,7 +875,7 @@ func TestRehashNestedIntersectionType(t *testing.T) {

storage, inter := newStorageAndInterpreter(t, ledger)

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -1028,7 +1028,7 @@ func TestIntersectionTypeMigrationWithInterfaceTypeConverter(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -1423,7 +1423,7 @@ func TestIntersectionTypeMigrationWithTypeConverters(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down
4 changes: 2 additions & 2 deletions migrations/statictypes/statictype_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestStaticTypeMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -757,7 +757,7 @@ func TestMigratingNestedContainers(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down
6 changes: 3 additions & 3 deletions migrations/string_normalization/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func TestStringNormalizingMigration(t *testing.T) {

// Migrate

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -440,7 +440,7 @@ func TestStringValueRehash(t *testing.T) {

storage, inter := newStorageAndInterpreter(t)

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down Expand Up @@ -583,7 +583,7 @@ func TestCharacterValueRehash(t *testing.T) {

storage, inter := newStorageAndInterpreter(t)

migration := migrations.NewStorageMigration(inter, storage)
migration := migrations.NewStorageMigration(inter, storage, "test")

reporter := newTestReporter()

Expand Down
Loading