Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6bb25982
Commit
6bb25982
authored
Jun 15, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add enable_ccx to the suite of override performance checking tests
parent
d56303dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
20 deletions
+39
-20
lms/djangoapps/ccx/tests/test_field_override_performance.py
+39
-20
No files found.
lms/djangoapps/ccx/tests/test_field_override_performance.py
View file @
6bb25982
...
@@ -7,6 +7,7 @@ import itertools
...
@@ -7,6 +7,7 @@ import itertools
import
mock
import
mock
from
courseware.views
import
progress
# pylint: disable=import-error
from
courseware.views
import
progress
# pylint: disable=import-error
from
courseware.field_overrides
import
OverrideFieldData
from
datetime
import
datetime
from
datetime
import
datetime
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.cache
import
get_cache
from
django.core.cache
import
get_cache
...
@@ -56,7 +57,7 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
...
@@ -56,7 +57,7 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
MakoMiddleware
()
.
process_request
(
self
.
request
)
MakoMiddleware
()
.
process_request
(
self
.
request
)
def
setup_course
(
self
,
size
):
def
setup_course
(
self
,
size
,
enable_ccx
):
"""
"""
Build a gradable course where each node has `size` children.
Build a gradable course where each node has `size` children.
"""
"""
...
@@ -98,7 +99,8 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
...
@@ -98,7 +99,8 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
self
.
course
=
CourseFactory
.
create
(
self
.
course
=
CourseFactory
.
create
(
graded
=
True
,
graded
=
True
,
start
=
datetime
.
now
(
UTC
),
start
=
datetime
.
now
(
UTC
),
grading_policy
=
grading_policy
grading_policy
=
grading_policy
,
enable_ccx
=
enable_ccx
,
)
)
self
.
populate_course
(
size
)
self
.
populate_course
(
size
)
...
@@ -117,11 +119,11 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
...
@@ -117,11 +119,11 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
student_id
=
self
.
student
.
id
student_id
=
self
.
student
.
id
)
)
def
instrument_course_progress_render
(
self
,
dataset_inde
x
,
queries
,
reads
,
xblocks
):
def
instrument_course_progress_render
(
self
,
course_width
,
enable_cc
x
,
queries
,
reads
,
xblocks
):
"""
"""
Renders the progress page, instrumenting Mongo reads and SQL queries.
Renders the progress page, instrumenting Mongo reads and SQL queries.
"""
"""
self
.
setup_course
(
dataset_index
+
1
)
self
.
setup_course
(
course_width
,
enable_ccx
)
# Switch to published-only mode to simulate the LMS
# Switch to published-only mode to simulate the LMS
with
self
.
settings
(
MODULESTORE_BRANCH
=
'published-only'
):
with
self
.
settings
(
MODULESTORE_BRANCH
=
'published-only'
):
...
@@ -135,17 +137,21 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
...
@@ -135,17 +137,21 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
# We clear the request cache to simulate a new request in the LMS.
# We clear the request cache to simulate a new request in the LMS.
RequestCache
.
clear_request_cache
()
RequestCache
.
clear_request_cache
()
# Reset the list of provider classes, so that our django settings changes
# can actually take affect.
OverrideFieldData
.
provider_classes
=
None
with
self
.
assertNumQueries
(
queries
):
with
self
.
assertNumQueries
(
queries
):
with
check_mongo_calls
(
reads
):
with
check_mongo_calls
(
reads
):
with
check_sum_of_calls
(
XBlock
,
[
'__init__'
],
xblocks
):
with
check_sum_of_calls
(
XBlock
,
[
'__init__'
],
xblocks
):
self
.
grade_course
(
self
.
course
)
self
.
grade_course
(
self
.
course
)
@ddt.data
(
*
itertools
.
product
((
'no_overrides'
,
'ccx'
),
range
(
3
)))
@ddt.data
(
*
itertools
.
product
((
'no_overrides'
,
'ccx'
),
range
(
1
,
4
),
(
True
,
False
)))
@ddt.unpack
@ddt.unpack
@override_settings
(
@override_settings
(
FIELD_OVERRIDE_PROVIDERS
=
(),
FIELD_OVERRIDE_PROVIDERS
=
(),
)
)
def
test_field_overrides
(
self
,
overrides
,
dataset_inde
x
):
def
test_field_overrides
(
self
,
overrides
,
course_width
,
enable_cc
x
):
"""
"""
Test without any field overrides.
Test without any field overrides.
"""
"""
...
@@ -154,8 +160,8 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
...
@@ -154,8 +160,8 @@ class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
'ccx'
:
(
'ccx.overrides.CustomCoursesForEdxOverrideProvider'
,)
'ccx'
:
(
'ccx.overrides.CustomCoursesForEdxOverrideProvider'
,)
}
}
with
self
.
settings
(
FIELD_OVERRIDE_PROVIDERS
=
providers
[
overrides
]):
with
self
.
settings
(
FIELD_OVERRIDE_PROVIDERS
=
providers
[
overrides
]):
queries
,
reads
,
xblocks
=
self
.
TEST_DATA
[
overrides
][
dataset_index
]
queries
,
reads
,
xblocks
=
self
.
TEST_DATA
[
(
overrides
,
course_width
,
enable_ccx
)
]
self
.
instrument_course_progress_render
(
dataset_inde
x
,
queries
,
reads
,
xblocks
)
self
.
instrument_course_progress_render
(
course_width
,
enable_cc
x
,
queries
,
reads
,
xblocks
)
class
TestFieldOverrideMongoPerformance
(
FieldOverridePerformanceTestCase
):
class
TestFieldOverrideMongoPerformance
(
FieldOverridePerformanceTestCase
):
...
@@ -166,12 +172,19 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):
...
@@ -166,12 +172,19 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):
__test__
=
True
__test__
=
True
TEST_DATA
=
{
TEST_DATA
=
{
'no_overrides'
:
[
# (providers, course_width, enable_ccx): # of sql queries, # of mongo queries, # of xblocks
(
27
,
7
,
19
),
(
135
,
7
,
131
),
(
595
,
7
,
537
)
(
'no_overrides'
,
1
,
True
):
(
27
,
7
,
19
),
],
(
'no_overrides'
,
2
,
True
):
(
135
,
7
,
131
),
'ccx'
:
[
(
'no_overrides'
,
3
,
True
):
(
595
,
7
,
537
),
(
27
,
7
,
47
),
(
135
,
7
,
455
),
(
595
,
7
,
2037
)
(
'ccx'
,
1
,
True
):
(
27
,
7
,
47
),
],
(
'ccx'
,
2
,
True
):
(
135
,
7
,
455
),
(
'ccx'
,
3
,
True
):
(
595
,
7
,
2037
),
(
'no_overrides'
,
1
,
False
):
(
27
,
7
,
19
),
(
'no_overrides'
,
2
,
False
):
(
135
,
7
,
131
),
(
'no_overrides'
,
3
,
False
):
(
595
,
7
,
537
),
(
'ccx'
,
1
,
False
):
(
27
,
7
,
19
),
(
'ccx'
,
2
,
False
):
(
135
,
7
,
131
),
(
'ccx'
,
3
,
False
):
(
595
,
7
,
537
),
}
}
...
@@ -183,10 +196,16 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
...
@@ -183,10 +196,16 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
__test__
=
True
__test__
=
True
TEST_DATA
=
{
TEST_DATA
=
{
'no_overrides'
:
[
(
'no_overrides'
,
1
,
True
):
(
27
,
4
,
9
),
(
27
,
4
,
9
),
(
135
,
19
,
54
),
(
595
,
84
,
215
)
(
'no_overrides'
,
2
,
True
):
(
135
,
19
,
54
),
],
(
'no_overrides'
,
3
,
True
):
(
595
,
84
,
215
),
'ccx'
:
[
(
'ccx'
,
1
,
True
):
(
27
,
4
,
9
),
(
27
,
4
,
9
),
(
135
,
19
,
54
),
(
595
,
84
,
215
)
(
'ccx'
,
2
,
True
):
(
135
,
19
,
54
),
]
(
'ccx'
,
3
,
True
):
(
595
,
84
,
215
),
(
'no_overrides'
,
1
,
False
):
(
27
,
4
,
9
),
(
'no_overrides'
,
2
,
False
):
(
135
,
19
,
54
),
(
'no_overrides'
,
3
,
False
):
(
595
,
84
,
215
),
(
'ccx'
,
1
,
False
):
(
27
,
4
,
9
),
(
'ccx'
,
2
,
False
):
(
135
,
19
,
54
),
(
'ccx'
,
3
,
False
):
(
595
,
84
,
215
),
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment