Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
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
cs_comments_service
Commits
da977fb7
Commit
da977fb7
authored
Aug 17, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add search test
parent
d76eefa3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
Rakefile
+3
-3
lib/tasks/benchmark.rake
+10
-3
No files found.
Rakefile
View file @
da977fb7
...
@@ -51,9 +51,9 @@ namespace :db do
...
@@ -51,9 +51,9 @@ namespace :db do
Subscription
.
delete_all
Subscription
.
delete_all
end
end
THREADS_PER_COMMENTABLE
=
20
THREADS_PER_COMMENTABLE
=
3
TOP_COMMENTS_PER_THREAD
=
3
TOP_COMMENTS_PER_THREAD
=
2
ADDITIONAL_COMMENTS_PER_THREAD
=
4
ADDITIONAL_COMMENTS_PER_THREAD
=
1
COURSE_ID
=
"MITx/6.002x/2012_Fall"
COURSE_ID
=
"MITx/6.002x/2012_Fall"
...
...
lib/tasks/benchmark.rake
View file @
da977fb7
...
@@ -28,7 +28,7 @@ namespace :benchmark do
...
@@ -28,7 +28,7 @@ namespace :benchmark do
x
.
report
"create new threads"
do
x
.
report
"create new threads"
do
(
1
..
THREADS
).
each
do
|
t
|
(
1
..
THREADS
).
each
do
|
t
|
data
=
{
title:
"Interesting question"
,
body:
"cool
"
,
anonymous:
false
,
\
data
=
{
title:
Faker
::
Lorem
.
sentence
(
6
)
+
" token
#{
rand
(
10
)
}
token
#{
rand
(
10
)
}
"
,
body:
Faker
::
Lorem
.
paragraphs
.
join
(
"
\n\n
"
)
+
" token
#{
rand
(
10
)
}
token
#{
rand
(
10
)
}
"
,
anonymous:
false
,
\
course_id:
"1"
,
user_id:
(
rand
(
USERS
)
+
1
).
to_s
,
\
course_id:
"1"
,
user_id:
(
rand
(
USERS
)
+
1
).
to_s
,
\
tags:
(
1
..
5
).
map
{
|
x
|
"tag
#{
rand
(
TAGS
)
}
"
}.
join
(
","
)}
tags:
(
1
..
5
).
map
{
|
x
|
"tag
#{
rand
(
TAGS
)
}
"
}.
join
(
","
)}
...
@@ -41,7 +41,7 @@ namespace :benchmark do
...
@@ -41,7 +41,7 @@ namespace :benchmark do
x
.
report
(
"create top comments"
)
do
x
.
report
(
"create top comments"
)
do
TOP_COMMENTS
.
times
do
TOP_COMMENTS
.
times
do
data
=
{
body:
"lalala
"
,
anonymous:
false
,
data
=
{
body:
Faker
::
Lorem
.
paragraphs
.
join
(
"
\n\n
"
)
+
" token
#{
rand
(
10
)
}
token
#{
rand
(
10
)
}
"
,
anonymous:
false
,
course_id:
"1"
,
user_id:
(
rand
(
USERS
)
+
1
).
to_s
}
course_id:
"1"
,
user_id:
(
rand
(
USERS
)
+
1
).
to_s
}
RestClient
.
post
"
#{
PREFIX
}
/threads/
#{
comment_thread_ids
.
sample
}
/comments"
,
data
RestClient
.
post
"
#{
PREFIX
}
/threads/
#{
comment_thread_ids
.
sample
}
/comments"
,
data
...
@@ -52,7 +52,7 @@ namespace :benchmark do
...
@@ -52,7 +52,7 @@ namespace :benchmark do
x
.
report
(
"create sub comments"
)
do
x
.
report
(
"create sub comments"
)
do
SUB_COMMENTS
.
times
do
SUB_COMMENTS
.
times
do
data
=
{
body:
"lalala
"
,
anonymous:
false
,
data
=
{
body:
Faker
::
Lorem
.
paragraphs
.
join
(
"
\n\n
"
)
+
" token
#{
rand
(
10
)
}
token
#{
rand
(
10
)
}
"
,
anonymous:
false
,
course_id:
"1"
,
user_id:
(
rand
(
USERS
)
+
1
).
to_s
}
course_id:
"1"
,
user_id:
(
rand
(
USERS
)
+
1
).
to_s
}
RestClient
.
post
"
#{
PREFIX
}
/comments/
#{
top_comment_ids
.
sample
}
"
,
data
RestClient
.
post
"
#{
PREFIX
}
/comments/
#{
top_comment_ids
.
sample
}
"
,
data
...
@@ -85,6 +85,13 @@ namespace :benchmark do
...
@@ -85,6 +85,13 @@ namespace :benchmark do
RestClient
.
get
"
#{
PREFIX
}
/threads"
,
params:
query_params
RestClient
.
get
"
#{
PREFIX
}
/threads"
,
params:
query_params
end
end
end
end
x
.
report
(
"searching threads in a course"
)
do
COURSE_THREAD_QUERY
.
times
do
query_params
=
{
course_id:
"1"
,
text:
"token
#{
rand
(
10
)
}
token
#{
rand
(
10
)
}
token
#{
rand
(
10
)
}
"
,
sort_key:
sort_keys
.
sample
,
sort_order:
sort_order
,
page:
1
+
rand
(
10
),
per_page:
5
}
RestClient
.
get
"
#{
PREFIX
}
/search/threads"
,
params:
query_params
end
end
end
end
end
end
end
end
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