Example #1
0
 def test_in_progress(self):
     set_migration_started('yellow', self.slug)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.IN_PROGRESS)
     self.assertEqual(get_migration_status('yellow', 'otherslug'),
                      MigrationStatus.NOT_STARTED)
Example #2
0
 def test_in_progress(self):
     set_migration_started('yellow', self.slug)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.IN_PROGRESS)
     self.assertEqual(get_migration_status('yellow', 'otherslug'),
                      MigrationStatus.NOT_STARTED)
Example #3
0
def set_couch_sql_migration_started(domain, live_migrate=False):
    if not live_migrate:
        # allow live (dry run) migration to be completed
        if get_couch_sql_migration_status(domain) == MigrationStatus.DRY_RUN:
            # avoid "Cannot start a migration that is already in state dry_run"
            set_couch_sql_migration_not_started(domain)
    set_migration_started(domain, COUCH_TO_SQL_SLUG, dry_run=live_migrate)
Example #4
0
 def test_migration_after_live_migration(self):
     set_migration_started('yellow', self.slug, dry_run=True)
     self.assertFalse(migration_in_progress('yellow', self.slug))
     self.assertTrue(
         migration_in_progress('yellow', self.slug, include_dry_runs=True))
     # Live migration finishes ... and is completed with normal migration
     set_migration_started('yellow', self.slug)
     self.assertTrue(migration_in_progress('yellow', self.slug))
Example #5
0
 def test_abort(self):
     set_migration_started('yellow', self.slug)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.IN_PROGRESS)
     set_migration_not_started('yellow', self.slug)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.NOT_STARTED)
Example #6
0
 def test_dry_run(self):
     set_migration_started('yellow', self.slug, True)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertFalse(migration_in_progress('yellow', self.slug))
     self.assertTrue(migration_in_progress('yellow', self.slug, True))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.DRY_RUN)
     self.assertEqual(get_migration_status('yellow', 'otherslug'),
                      MigrationStatus.NOT_STARTED)
Example #7
0
 def test_any_migrations_in_progress(self):
     self.assertFalse(any_migrations_in_progress('purple'))
     set_migration_started('purple', self.slug)
     self.assertTrue(any_migrations_in_progress('purple'))
     set_migration_started('purple', 'other_slug')
     set_migration_not_started('purple', self.slug)
     self.assertTrue(any_migrations_in_progress('purple'))
     set_migration_complete('purple', 'other_slug')
     self.assertFalse(any_migrations_in_progress('purple'))
 def test_any_migrations_in_progress(self):
     self.assertFalse(any_migrations_in_progress('purple'))
     set_migration_started('purple', self.slug)
     self.assertTrue(any_migrations_in_progress('purple'))
     set_migration_started('purple', 'other_slug')
     set_migration_not_started('purple', self.slug)
     self.assertTrue(any_migrations_in_progress('purple'))
     set_migration_complete('purple', 'other_slug')
     self.assertFalse(any_migrations_in_progress('purple'))
 def test_dry_run(self):
     set_migration_started('yellow', self.slug, True)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertFalse(migration_in_progress('yellow', self.slug))
     self.assertTrue(migration_in_progress('yellow', self.slug, True))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.DRY_RUN)
     self.assertEqual(get_migration_status('yellow', 'otherslug'),
                      MigrationStatus.NOT_STARTED)
 def test_abort(self):
     set_migration_started('yellow', self.slug)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.IN_PROGRESS)
     set_migration_not_started('yellow', self.slug)
     self.assertFalse(get_migration_complete('yellow', self.slug))
     self.assertEqual(get_migration_status('yellow', self.slug),
                      MigrationStatus.NOT_STARTED)
Example #11
0
 def test_continue_live_migration(self):
     set_migration_started('yellow', self.slug, dry_run=True)
     self.assertFalse(migration_in_progress('yellow', self.slug))
     self.assertTrue(
         migration_in_progress('yellow', self.slug, include_dry_runs=True))
     # Live migration finishes ... and is continued later
     set_migration_started('yellow', self.slug, dry_run=True)
     self.assertFalse(migration_in_progress('yellow', self.slug))
     self.assertTrue(
         migration_in_progress('yellow', self.slug, include_dry_runs=True))
Example #12
0
    def test_dry_run(self):
        set_migration_started('yellow', self.slug, dry_run=True)
        self.assertFalse(get_migration_complete('yellow', self.slug))
        self.assertFalse(migration_in_progress('yellow', self.slug))
        self.assertTrue(migration_in_progress('yellow', self.slug, True))
        self.assertEqual(get_migration_status('yellow', self.slug),
                         MigrationStatus.DRY_RUN)
        self.assertEqual(get_migration_status('yellow', 'otherslug'),
                         MigrationStatus.NOT_STARTED)

        progress = self.get_progress('yellow')
        self.assertIsNotNone(progress.started_on)
        self.assertLessEqual(progress.started_on, datetime.utcnow())
    def test_dry_run(self):
        set_migration_started('yellow', self.slug, dry_run=True)
        self.assertFalse(get_migration_complete('yellow', self.slug))
        self.assertFalse(migration_in_progress('yellow', self.slug))
        self.assertTrue(migration_in_progress('yellow', self.slug, True))
        self.assertEqual(get_migration_status('yellow', self.slug),
                         MigrationStatus.DRY_RUN)
        self.assertEqual(get_migration_status('yellow', 'otherslug'),
                         MigrationStatus.NOT_STARTED)

        progress = self.get_progress('yellow')
        self.assertIsNotNone(progress.started_on)
        self.assertLessEqual(progress.started_on, datetime.utcnow())
Example #14
0
def set_tz_migration_started(domain):
    return set_migration_started(domain, TZMIGRATION_SLUG)
Example #15
0
def set_couch_sql_migration_started(domain):
    set_migration_started(domain, COUCH_TO_SQL_SLUG)
Example #16
0
def set_couch_sql_migration_started(domain, dry_run=False):
    set_migration_started(domain, COUCH_TO_SQL_SLUG, dry_run)
Example #17
0
def set_couch_sql_migration_started(domain, dry_run=False):
    set_migration_started(domain, COUCH_TO_SQL_SLUG, dry_run)
Example #18
0
def set_couch_sql_migration_started(domain):
    set_migration_started(domain, COUCH_TO_SQL_SLUG)
Example #19
0
def set_tz_migration_started(domain):
    return set_migration_started(domain, TZMIGRATION_SLUG)