Merge pull request #4534 from edx/nimisha/import-perf-unit-test-STUD-1994
Unit test for import performance STUD-1994
This commit is contained in:
@@ -200,10 +200,10 @@ class TestCourseListing(ModuleStoreTestCase):
|
||||
|
||||
# Now count the db queries
|
||||
store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo)
|
||||
with check_mongo_calls(store.collection, USER_COURSES_COUNT):
|
||||
with check_mongo_calls(store, USER_COURSES_COUNT):
|
||||
courses_list = _accessible_courses_list_from_groups(self.request)
|
||||
|
||||
with check_mongo_calls(store.collection, 1):
|
||||
with check_mongo_calls(store, 1):
|
||||
courses_list = _accessible_courses_list(self.request)
|
||||
|
||||
def test_get_course_list_with_same_course_id(self):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# pylint: disable=E1101
|
||||
# pylint: disable=protected-access
|
||||
"""
|
||||
Tests for import_from_xml using the mongo modulestore.
|
||||
"""
|
||||
@@ -10,8 +11,10 @@ from django.conf import settings
|
||||
import copy
|
||||
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.tests.factories import check_exact_number_of_calls, check_number_of_calls
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey, AssetLocation
|
||||
from xmodule.modulestore.xml_importer import import_from_xml
|
||||
from xmodule.exceptions import NotFoundError
|
||||
@@ -149,6 +152,21 @@ class ContentStoreImportTest(ModuleStoreTestCase):
|
||||
print "course tabs = {0}".format(course.tabs)
|
||||
self.assertEqual(course.tabs[2]['name'], 'Syllabus')
|
||||
|
||||
def test_import_performance_mongo(self):
|
||||
store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo)
|
||||
|
||||
# we try to refresh the inheritance tree for each update_item in the import
|
||||
with check_exact_number_of_calls(store, store.refresh_cached_metadata_inheritance_tree, 46):
|
||||
|
||||
# the post-publish step loads each item in the subtree, which calls _get_cached_metadata_inheritance_tree
|
||||
with check_exact_number_of_calls(store, store._get_cached_metadata_inheritance_tree, 22):
|
||||
|
||||
# with bulk-edit in progress, the inheritance tree should be recomputed only at the end of the import
|
||||
# NOTE: On Jenkins, with memcache enabled, the number of calls here is only 1.
|
||||
# Locally, without memcache, the number of calls is actually 2 (once more during the publish step)
|
||||
with check_number_of_calls(store, store._compute_metadata_inheritance_tree, 2):
|
||||
self.load_test_import_course()
|
||||
|
||||
def test_rewrite_reference_list(self):
|
||||
module_store = modulestore()
|
||||
target_course_id = SlashSeparatedCourseKey('testX', 'conditional_copy', 'copy_run')
|
||||
|
||||
Reference in New Issue
Block a user