Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a0bf63a1
Unverified
Commit
a0bf63a1
authored
7 years ago
by
Robert Raposa
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #16967 from edx/robrap/remove-flaky-timing-assertions
PLAT-1864: Fix test_course_listing_performance flaky test.
parents
82ad9295
d2b0d0cd
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cms/djangoapps/contentstore/tests/test_course_listing.py
+8
-18
8 additions, 18 deletions
cms/djangoapps/contentstore/tests/test_course_listing.py
with
8 additions
and
18 deletions
cms/djangoapps/contentstore/tests/test_course_listing.py
+
8
−
18
View file @
a0bf63a1
...
...
@@ -264,32 +264,22 @@ class TestCourseListing(ModuleStoreTestCase):
else
:
self
.
_create_course_with_access_groups
(
course_location
,
store
=
store
)
# time the get courses by iterating through all courses
with
Timer
()
as
iteration_over_courses_time_1
:
courses_iter
,
__
=
_accessible_courses_iter_for_tests
(
self
.
request
)
# get courses by iterating through all courses
courses_iter
,
__
=
_accessible_courses_iter_for_tests
(
self
.
request
)
self
.
assertEqual
(
len
(
list
(
courses_iter
)),
USER_COURSES_COUNT
)
# time again the get courses by iterating through all courses
with
Timer
()
as
iteration_over_courses_time_2
:
courses_iter
,
__
=
_accessible_courses_iter_for_tests
(
self
.
request
)
# again get courses by iterating through all courses
courses_iter
,
__
=
_accessible_courses_iter_for_tests
(
self
.
request
)
self
.
assertEqual
(
len
(
list
(
courses_iter
)),
USER_COURSES_COUNT
)
# time the get courses by reversing django groups
with
Timer
()
as
iteration_over_groups_time_1
:
courses_list
,
__
=
_accessible_courses_list_from_groups
(
self
.
request
)
# get courses by reversing django groups
courses_list
,
__
=
_accessible_courses_list_from_groups
(
self
.
request
)
self
.
assertEqual
(
len
(
courses_list
),
USER_COURSES_COUNT
)
# time again the get courses by reversing django groups
with
Timer
()
as
iteration_over_groups_time_2
:
courses_list
,
__
=
_accessible_courses_list_from_groups
(
self
.
request
)
# again get courses by reversing django groups
courses_list
,
__
=
_accessible_courses_list_from_groups
(
self
.
request
)
self
.
assertEqual
(
len
(
courses_list
),
USER_COURSES_COUNT
)
# Test that the time taken by getting courses through reversing django
# groups is lower then the time taken by traversing through all courses
# (if accessible courses are relatively small).
self
.
assertGreaterEqual
(
iteration_over_courses_time_1
.
elapsed
,
iteration_over_groups_time_1
.
elapsed
)
self
.
assertGreaterEqual
(
iteration_over_courses_time_2
.
elapsed
,
iteration_over_groups_time_2
.
elapsed
)
# Now count the db queries
with
check_mongo_calls
(
courses_list_from_group_calls
):
_accessible_courses_list_from_groups
(
self
.
request
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment