Skip to content

Commit

Permalink
Bump migration timeout (#420)
Browse files Browse the repository at this point in the history
* migrations: bump timeout

Signed-off-by: Sander Pick <[email protected]>

* migrations: clean up

Signed-off-by: Sander Pick <[email protected]>

* users: add billing api js files

Signed-off-by: Sander Pick <[email protected]>
  • Loading branch information
sanderpick authored Nov 21, 2020
1 parent df6a347 commit 27ef03d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
6 changes: 5 additions & 1 deletion api/usersd/pb/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"api/usersd/pb/usersd_pb.js",
"api/usersd/pb/usersd_pb_service.js",
"api/usersd/pb/usersd_pb.d.ts",
"api/usersd/pb/usersd_pb_service.d.ts"
"api/usersd/pb/usersd_pb_service.d.ts",
"api/billingd/pb/billingd_pb.js",
"api/billingd/pb/billingd_pb_service.js",
"api/billingd/pb/billingd_pb.d.ts",
"api/billingd/pb/billingd_pb_service.d.ts"
],
"dependencies": {
"@improbable-eng/grpc-web": "^0.13.0",
Expand Down
5 changes: 2 additions & 3 deletions mongodb/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

var (
log = logging.Logger("migrations")
migrateTimeout = time.Minute
migrateTimeout = time.Hour
)

var m001 = migrate.Migration{
Expand Down Expand Up @@ -97,8 +97,7 @@ var m002 = migrate.Migration{
if cursor.Err() != nil {
return cursor.Err()
}
//return db.Collection("users").Drop(ctx)
return nil
return db.Collection("users").Drop(ctx)
},
Down: func(db *mongo.Database) error {
log.Info("migrating 002 down")
Expand Down
24 changes: 12 additions & 12 deletions mongodb/migrations/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ func TestMigrations_m002(t *testing.T) {
count, err = db.Collection("accounts").CountDocuments(ctx, bson.M{"type": 2})
require.NoError(t, err)
assert.Equal(t, 3, int(count))
//count, err = db.Collection("users").CountDocuments(ctx, bson.M{})
//require.NoError(t, err)
//assert.Equal(t, 0, int(count))
count, err = db.Collection("users").CountDocuments(ctx, bson.M{})
require.NoError(t, err)
assert.Equal(t, 0, int(count))

// Run down
// err = migrate.NewMigrate(db, m002).Down(migrate.AllAvailable)
// require.NoError(t, err)

//count, err = db.Collection("accounts").CountDocuments(ctx, bson.M{})
//require.NoError(t, err)
//assert.Equal(t, 3, int(count))
//count, err = db.Collection("users").CountDocuments(ctx, bson.M{})
//require.NoError(t, err)
//assert.Equal(t, 3, int(count))
err = migrate.NewMigrate(db, m002).Down(migrate.AllAvailable)
require.NoError(t, err)

count, err = db.Collection("accounts").CountDocuments(ctx, bson.M{})
require.NoError(t, err)
assert.Equal(t, 3, int(count))
count, err = db.Collection("users").CountDocuments(ctx, bson.M{})
require.NoError(t, err)
assert.Equal(t, 3, int(count))
}

// Test remove buckets_total_size from accounts
Expand Down

0 comments on commit 27ef03d

Please sign in to comment.