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
5c00ce67
Commit
5c00ce67
authored
Sep 30, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test multiple threads linear growth
parent
b7b5400c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
cms/djangoapps/contentstore/views/tests/test_course_index.py
+29
-2
No files found.
cms/djangoapps/contentstore/views/tests/test_course_index.py
View file @
5c00ce67
...
...
@@ -8,17 +8,19 @@ import datetime
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
,
add_instructor
from
contentstore.views.access
import
has_course_access
from
contentstore.views.course
import
course_outline_initial_state
from
contentstore.views.course
import
course_outline_initial_state
,
_course_outline_json
from
contentstore.views.item
import
create_xblock_info
,
VisibilityState
from
course_action_state.models
import
CourseRerunState
from
util.date_utils
import
get_default_time_display
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
,
check_mongo_calls
from
opaque_keys.edx.locator
import
CourseLocator
from
student.tests.factories
import
UserFactory
from
course_action_state.managers
import
CourseRerunUIStateManager
from
django.conf
import
settings
import
ddt
import
threading
class
TestCourseIndex
(
CourseTestCase
):
...
...
@@ -308,3 +310,28 @@ class TestCourseOutline(CourseTestCase):
self
.
assertEqual
(
_get_release_date
(
response
),
get_default_time_display
(
self
.
course
.
start
))
_assert_settings_link_present
(
response
)
@ddt.ddt
class
OutlinePerfTest
(
TestCourseOutline
):
def
setUp
(
self
):
with
modulestore
()
.
default_store
(
ModuleStoreEnum
.
Type
.
split
):
super
(
OutlinePerfTest
,
self
)
.
setUp
()
@ddt.data
(
1
,
2
,
4
,
8
)
def
test_query_counts
(
self
,
num_threads
):
"""
Test that increasing threads does not increase query counts
"""
def
test_client
():
with
modulestore
()
.
default_store
(
ModuleStoreEnum
.
Type
.
split
):
with
modulestore
()
.
bulk_operations
(
self
.
course
.
id
):
course
=
modulestore
()
.
get_course
(
self
.
course
.
id
,
depth
=
0
)
return
_course_outline_json
(
None
,
course
)
with
check_mongo_calls
(
5
*
num_threads
,
0
):
outline_threads
=
[
threading
.
Thread
(
target
=
test_client
)
for
__
in
range
(
num_threads
)]
[
thread
.
start
()
for
thread
in
outline_threads
]
self
.
assertTrue
(
all
(
thread
.
is_alive
()
for
thread
in
outline_threads
))
# now wait until they all finish
[
thread
.
join
()
for
thread
in
outline_threads
]
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