Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: AA-1058: Update edx-when version #29073

Merged
merged 1 commit into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lms/djangoapps/ccx/tests/test_field_override_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):
__test__ = True

# TODO: decrease query count as part of REVO-28
QUERY_COUNT = 33
QUERY_COUNT = 34
TEST_DATA = {
# (providers, course_width, enable_ccx, view_as_ccx): (
# # of sql queries to default,
Expand Down Expand Up @@ -271,7 +271,7 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
__test__ = True

# TODO: decrease query count as part of REVO-28
QUERY_COUNT = 33
QUERY_COUNT = 34

TEST_DATA = {
('no_overrides', 1, True, False): (QUERY_COUNT, 3),
Expand Down
6 changes: 3 additions & 3 deletions lms/djangoapps/course_api/blocks/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def test_query_counts_cached(self, store_type, with_storage_backing):
self._get_blocks(
course,
expected_mongo_queries=0,
expected_sql_queries=13 if with_storage_backing else 12,
expected_sql_queries=14 if with_storage_backing else 13,
)

@ddt.data(
Expand All @@ -237,9 +237,9 @@ def test_query_counts_uncached(self, store_type_tuple, with_storage_backing):
clear_course_from_cache(course.id)

if with_storage_backing:
num_sql_queries = 23
num_sql_queries = 24
else:
num_sql_queries = 13
num_sql_queries = 14

self._get_blocks(
course,
Expand Down
8 changes: 4 additions & 4 deletions lms/djangoapps/courseware/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ class IndexQueryTestCase(ModuleStoreTestCase):
NUM_PROBLEMS = 20

@ddt.data(
(ModuleStoreEnum.Type.mongo, 10, 164),
(ModuleStoreEnum.Type.split, 4, 160),
(ModuleStoreEnum.Type.mongo, 10, 227),
(ModuleStoreEnum.Type.split, 4, 210),
Comment on lines -391 to +392
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These and the test_resolvers change below are big bumps. That seems worrying? At first blush, this test doesn't appear to be doing a similar thing 50 times, but I didn't chase its logic fully.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dillon made https://openedx.atlassian.net/browse/AA-1081 to capture this issue as a follow-on item. In particular:

Although improving this is a great thing and we should do it/look into it, I do want to call out that the _load_dates function uses the read replica so hopefully even the introduction of these queries doesn't have an effect on production.

)
@ddt.unpack
def test_index_query_counts(self, store_type, expected_mongo_query_count, expected_mysql_query_count):
Expand Down Expand Up @@ -1597,8 +1597,8 @@ def test_progress_queries_paced_courses(self, self_paced, query_count):

@patch.dict(settings.FEATURES, {'ASSUME_ZERO_GRADE_IF_ABSENT_FOR_ALL_TESTS': False})
@ddt.data(
(False, 63, 44),
(True, 55, 38)
(False, 63, 45),
(True, 55, 39)
)
@ddt.unpack
def test_progress_queries(self, enable_waffle, initial, subsequent):
Expand Down
18 changes: 9 additions & 9 deletions lms/djangoapps/grades/tests/test_course_grade_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,35 +95,35 @@ def _assert_section_order(course_grade):
self.sequence2.display_name
]

with self.assertNumQueries(3), mock_get_score(1, 2):
with self.assertNumQueries(5), mock_get_score(1, 2):
_assert_read(expected_pass=False, expected_percent=0) # start off with grade of 0

num_queries = 42
num_queries = 43
with self.assertNumQueries(num_queries), mock_get_score(1, 2):
grade_factory.update(self.request.user, self.course, force_update_subsections=True)

with self.assertNumQueries(3):
with self.assertNumQueries(4):
_assert_read(expected_pass=True, expected_percent=0.5) # updated to grade of .5

num_queries = 6
num_queries = 7
with self.assertNumQueries(num_queries), mock_get_score(1, 4):
grade_factory.update(self.request.user, self.course, force_update_subsections=False)

with self.assertNumQueries(3):
with self.assertNumQueries(4):
_assert_read(expected_pass=True, expected_percent=0.5) # NOT updated to grade of .25

num_queries = 23
num_queries = 24
with self.assertNumQueries(num_queries), mock_get_score(2, 2):
grade_factory.update(self.request.user, self.course, force_update_subsections=True)

with self.assertNumQueries(3):
with self.assertNumQueries(4):
_assert_read(expected_pass=True, expected_percent=1.0) # updated to grade of 1.0

num_queries = 29
num_queries = 30
with self.assertNumQueries(num_queries), mock_get_score(0, 0): # the subsection now is worth zero
grade_factory.update(self.request.user, self.course, force_update_subsections=True)

with self.assertNumQueries(3):
with self.assertNumQueries(4):
_assert_read(expected_pass=False, expected_percent=0.0) # updated to grade of 0.0

@patch.dict(settings.FEATURES, {'ASSUME_ZERO_GRADE_IF_ABSENT_FOR_ALL_TESTS': False})
Expand Down
20 changes: 10 additions & 10 deletions lms/djangoapps/grades/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ def test_block_structure_created_only_once(self):
assert mock_block_structure_create.call_count == 1

@ddt.data(
(ModuleStoreEnum.Type.mongo, 1, 39, True),
(ModuleStoreEnum.Type.mongo, 1, 39, False),
(ModuleStoreEnum.Type.split, 3, 39, True),
(ModuleStoreEnum.Type.split, 3, 39, False),
(ModuleStoreEnum.Type.mongo, 1, 40, True),
(ModuleStoreEnum.Type.mongo, 1, 40, False),
(ModuleStoreEnum.Type.split, 3, 40, True),
(ModuleStoreEnum.Type.split, 3, 40, False),
)
@ddt.unpack
def test_query_counts(self, default_store, num_mongo_calls, num_sql_calls, create_multiple_subsections):
Expand All @@ -177,8 +177,8 @@ def test_query_counts(self, default_store, num_mongo_calls, num_sql_calls, creat
self._apply_recalculate_subsection_grade()

@ddt.data(
(ModuleStoreEnum.Type.mongo, 1, 39),
(ModuleStoreEnum.Type.split, 3, 39),
(ModuleStoreEnum.Type.mongo, 1, 40),
(ModuleStoreEnum.Type.split, 3, 40),
)
@ddt.unpack
def test_query_counts_dont_change_with_more_content(self, default_store, num_mongo_calls, num_sql_calls):
Expand Down Expand Up @@ -223,8 +223,8 @@ def test_other_inaccessible_subsection(self, mock_subsection_signal):
)

@ddt.data(
(ModuleStoreEnum.Type.mongo, 1, 22),
(ModuleStoreEnum.Type.split, 3, 22),
(ModuleStoreEnum.Type.mongo, 1, 23),
(ModuleStoreEnum.Type.split, 3, 23),
)
@ddt.unpack
def test_persistent_grades_not_enabled_on_course(self, default_store, num_mongo_queries, num_sql_queries):
Expand All @@ -238,8 +238,8 @@ def test_persistent_grades_not_enabled_on_course(self, default_store, num_mongo_
assert len(PersistentSubsectionGrade.bulk_read_grades(self.user.id, self.course.id)) == 0

@ddt.data(
(ModuleStoreEnum.Type.mongo, 1, 40),
(ModuleStoreEnum.Type.split, 3, 40),
(ModuleStoreEnum.Type.mongo, 1, 41),
(ModuleStoreEnum.Type.split, 3, 41),
)
@ddt.unpack
def test_persistent_grades_enabled_on_course(self, default_store, num_mongo_queries, num_sql_queries):
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/schedules/tests/test_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def create_resolver(self, user_start_date_offset=8):
def test_schedule_context(self):
resolver = self.create_resolver()
# using this to make sure the select_related stays intact
with self.assertNumQueries(26):
with self.assertNumQueries(36):
sc = resolver.get_schedules()
schedules = list(sc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def test_queries(self):

# Fetch the view and verify the query counts
# TODO: decrease query count as part of REVO-28
with self.assertNumQueries(72, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST):
with self.assertNumQueries(73, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST):
with check_mongo_calls(4):
url = course_home_url(self.course)
self.client.get(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_queries(self):

# Fetch the view and verify that the query counts haven't changed
# TODO: decrease query count as part of REVO-28
with self.assertNumQueries(50, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST):
with self.assertNumQueries(53, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST):
with check_mongo_calls(4):
url = course_updates_url(self.course)
self.client.get(url)
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ edx-toggles==4.2.0
# ora2
edx-user-state-client==1.3.2
# via -r requirements/edx/base.in
edx-when==2.2.1
edx-when==2.2.2
# via
# -r requirements/edx/base.in
# edx-proctoring
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ edx-toggles==4.2.0
# ora2
edx-user-state-client==1.3.2
# via -r requirements/edx/testing.txt
edx-when==2.2.1
edx-when==2.2.2
# via
# -r requirements/edx/testing.txt
# edx-proctoring
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ edx-toggles==4.2.0
# ora2
edx-user-state-client==1.3.2
# via -r requirements/edx/base.txt
edx-when==2.2.1
edx-when==2.2.2
# via
# -r requirements/edx/base.txt
# edx-proctoring
Expand Down