Merge pull request #15918 from edx/jmbowman/test_reliability_fixes

Fix tests that depend on execution order
This commit is contained in:
Jeremy Bowman
2017-08-29 13:46:59 -04:00
committed by GitHub
8 changed files with 44 additions and 11 deletions

View File

@@ -740,6 +740,12 @@ class TestTaskExecution(SharedModuleStoreTestCase):
publish_item=False,
)
@classmethod
def tearDownClass(cls):
SignalHandler.course_published.connect(listen_for_course_publish)
SignalHandler.library_updated.connect(listen_for_library_update)
super(TestTaskExecution, cls).tearDownClass()
def test_task_indexing_course(self):
""" Making sure that the receiver correctly fires off the task when invoked by signal """
searcher = SearchEngine.get_search_engine(CoursewareSearchIndexer.INDEX_NAME)

View File

@@ -23,9 +23,11 @@ from contentstore.views.course import (
course_outline_initial_state,
reindex_course_and_check_access
)
from contentstore.views.course import WAFFLE_NAMESPACE as COURSE_WAFFLE_NAMESPACE
from contentstore.views.item import VisibilityState, create_xblock_info
from course_action_state.managers import CourseRerunUIStateManager
from course_action_state.models import CourseRerunState
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
from student.auth import has_course_author_access
from student.roles import CourseStaffRole, GlobalStaff, LibraryUserRole
from student.tests.factories import UserFactory
@@ -359,6 +361,10 @@ class TestCourseIndexArchived(CourseTestCase):
for course in (self.course, self.active_course, self.archived_course):
CourseStaffRole(course.id).add_users(self.staff)
# Make sure we've cached data which could change the query counts
# depending on test execution order
WaffleSwitchNamespace(name=COURSE_WAFFLE_NAMESPACE).is_enabled(u'enable_global_staff_optimization')
def check_index_page_with_query_count(self, separate_archived_courses, org, mongo_queries, sql_queries):
"""
Checks the index page, and ensures the number of database queries is as expected.