Skip to content

Commit

Permalink
Drops celery_taskmeta collection
Browse files Browse the repository at this point in the history
  • Loading branch information
dkliban committed Aug 31, 2015
1 parent 00252c0 commit 4be2419
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
18 changes: 18 additions & 0 deletions server/pulp/server/db/migrations/0020_drop_celery_taskmeta.py
@@ -0,0 +1,18 @@
"""
This migration removes the `celery_taskmeta` collection.
"""
from pulp.server.db import connection


def migrate(*args, **kwargs):
"""
Perform the migration as described in this module's docblock.
:param args: unused
:type args: list
:param kwargs: unused
:type kwargs: dict
"""
db = connection.get_database()
collection = db['celery_taskmeta']
collection.drop()
@@ -0,0 +1,23 @@
"""
This module contains tests for pulp.server.db.migrations.0020_drop_celery_taskmeta.py
"""
import unittest

from mock import patch

from pulp.server.db.migrate.models import _import_all_the_way

migration = _import_all_the_way('pulp.server.db.migrations.0020_drop_celery_taskmeta')


class TestMigrate(unittest.TestCase):
"""
Test the migrate() function.
"""

@patch.object(migration.connection, 'get_database')
def test_celery_taskmeta_collection_dropped(self, mock_get_database):
mock_get_database.return_value.collection_names.return_value = []
collection = mock_get_database.return_value['celery_taskmeta']
migration.migrate()
collection.drop.assert_called_once()

0 comments on commit 4be2419

Please sign in to comment.