Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
28e2e77d
Commit
28e2e77d
authored
Apr 05, 2019
by
Ramya Authappan
Committed by
Sanad Liaquat
Apr 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding perf testdata for MR diff tab
parent
9646e451
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
8 deletions
+59
-8
qa/qa/tools/generate_perf_testdata.rb
qa/qa/tools/generate_perf_testdata.rb
+59
-8
No files found.
qa/qa/tools/generate_perf_testdata.rb
View file @
28e2e77d
...
@@ -33,6 +33,7 @@ module QA
...
@@ -33,6 +33,7 @@ module QA
add_new_file
add_new_file
methods_arr
=
[
methods_arr
=
[
method
(
:create_issues
),
method
(
:create_issues
),
method
(
:create_labels
),
method
(
:create_todos
),
method
(
:create_todos
),
method
(
:create_merge_requests
),
method
(
:create_merge_requests
),
method
(
:create_issue_with_500_discussions
),
method
(
:create_issue_with_500_discussions
),
...
@@ -80,6 +81,15 @@ module QA
...
@@ -80,6 +81,15 @@ module QA
STDOUT
.
puts
"Created todos"
STDOUT
.
puts
"Created todos"
end
end
def
create_labels
30
.
times
do
|
i
|
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/labels"
).
url
,
"name=label
#{
i
}
&color=
#{
Faker
::
Color
.
hex_color
}
"
end
@urls
[
:labels_page
]
=
@urls
[
:project_page
]
+
"/labels"
STDOUT
.
puts
"Created labels"
end
def
create_merge_requests
def
create_merge_requests
30
.
times
do
|
i
|
30
.
times
do
|
i
|
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests"
).
url
,
"source_branch=branch
#{
i
}
&target_branch=master&title=MR
#{
i
}
"
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests"
).
url
,
"source_branch=branch
#{
i
}
&target_branch=master&title=MR
#{
i
}
"
...
@@ -108,36 +118,77 @@ module QA
...
@@ -108,36 +118,77 @@ module QA
500
.
times
do
500
.
times
do
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/issues/
#{
issue_id
}
/discussions"
).
url
,
"body=
\"
Let us discuss
\"
"
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/issues/
#{
issue_id
}
/discussions"
).
url
,
"body=
\"
Let us discuss
\"
"
end
end
labels_list
=
(
0
..
15
).
map
{
|
i
|
"label
#{
i
}
"
}.
join
(
','
)
# Add description and labels
put
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/issues/
#{
issue_id
}
"
).
url
,
"description=
#{
Faker
::
Lorem
.
sentences
(
500
).
join
(
" "
)
}
&labels=
#{
labels_list
}
"
@urls
[
:large_issue
]
=
@urls
[
:project_page
]
+
"/issues/
#{
issue_id
}
"
@urls
[
:large_issue
]
=
@urls
[
:project_page
]
+
"/issues/
#{
issue_id
}
"
STDOUT
.
puts
"Created Issue with 500 Discussions"
STDOUT
.
puts
"Created Issue with 500 Discussions"
end
end
def
create_mr_with_large_files
def
create_mr_with_large_files
content_arr
=
[]
content_arr
=
[]
20
.
times
do
|
i
|
16
.
times
do
|
i
|
faker_line_arr
=
Faker
::
Lorem
.
sentences
(
1500
)
faker_line_arr
=
Faker
::
Lorem
.
sentences
(
1500
)
content
=
faker_line_arr
.
join
(
"
\n\r
"
)
content
=
faker_line_arr
.
join
(
"
\n\r
"
)
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/repository/files/hello
#{
i
}
.txt"
).
url
,
"branch=master&commit_message=
\"
Add hello
#{
i
}
.txt
\"
&content=
#{
content
}
"
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/repository/files/hello
#{
i
}
.txt"
).
url
,
"branch=master&commit_message=
\"
Add hello
#{
i
}
.txt
\"
&content=
#{
content
}
"
content_arr
[
i
]
=
faker_line_arr
content_arr
[
i
]
=
faker_line_arr
end
end
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/repository/branches"
).
url
,
"branch=performance&ref=master"
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/repository/branches"
).
url
,
"branch=performance&ref=master"
20
.
times
do
|
i
|
16
.
times
do
|
i
|
missed_line_array
=
content_arr
[
i
].
each_slice
(
2
).
map
(
&
:first
)
missed_line_array
=
content_arr
[
i
].
each_slice
(
2
).
map
(
&
:first
)
content
=
missed_line_array
.
join
(
"
\n\r
Im new!:D
\n\r
"
)
content
=
missed_line_array
.
join
(
"
\n\r
Im new!:D
\n\r
"
)
put
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/repository/files/hello
#{
i
}
.txt"
).
url
,
"branch=performance&commit_message=
\"
Update hello
#{
i
}
.txt
\"
&content=
#{
content
}
"
put
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/repository/files/hello
#{
i
}
.txt"
).
url
,
"branch=performance&commit_message=
\"
Update hello
#{
i
}
.txt
\"
&content=
#{
content
}
"
end
end
create_mr_response
=
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests"
).
url
,
"source_branch=performance&target_branch=master&title=Large_MR"
create_mr_response
=
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"""/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests"""
).
url
,
"source_branch=performance&target_branch=master&title=Large_MR"
iid
=
JSON
.
parse
(
create_mr_response
.
body
)[
"iid"
]
iid
=
JSON
.
parse
(
create_mr_response
.
body
)[
"iid"
]
500
.
times
do
diff_refs
=
JSON
.
parse
(
create_mr_response
.
body
)[
"diff_refs"
]
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests/
#{
iid
}
/discussions"
).
url
,
"body=
\"
Let us discuss
\"
"
# Add discussions to diff tab and resolve a few!
should_resolve
=
false
16
.
times
do
|
i
|
1
.
upto
(
9
)
do
|
j
|
create_diff_note
(
iid
,
i
,
j
,
diff_refs
[
"head_sha"
],
diff_refs
[
"start_sha"
],
diff_refs
[
"base_sha"
],
"new_line"
)
create_diff_note_response
=
create_diff_note
(
iid
,
i
,
j
,
diff_refs
[
"head_sha"
],
diff_refs
[
"start_sha"
],
diff_refs
[
"base_sha"
],
"old_line"
)
if
should_resolve
discussion_id
=
JSON
.
parse
(
create_diff_note_response
.
body
)[
"id"
]
put
Runtime
::
API
::
Request
.
new
(
@api_client
,
"""/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests/
#{
iid
}
/discussions/
#{
discussion_id
}
"""
).
url
,
"resolved=true"
end
should_resolve
^=
true
end
end
# Add discussions to main tab
100
.
times
do
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests/
#{
iid
}
/discussions"
).
url
,
"body=
\"
Let us discuss
\"
"
end
end
@urls
[
:large_mr
]
=
JSON
.
parse
(
create_mr_response
.
body
)[
"web_url"
]
@urls
[
:large_mr
]
=
JSON
.
parse
(
create_mr_response
.
body
)[
"web_url"
]
STDOUT
.
puts
"Created MR with 500 Discussions and 20 Very Large Files"
STDOUT
.
puts
"Created MR with 500 Discussions and 20 Very Large Files"
end
end
def
create_diff_note
(
iid
,
file_count
,
line_count
,
head_sha
,
start_sha
,
base_sha
,
line_type
)
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests/
#{
iid
}
/discussions"
).
url
,
"""body=
\"
Let us discuss
\"
&
position[position_type]=text&
position[new_path]=hello
#{
file_count
}
.txt&
position[old_path]=hello
#{
file_count
}
.txt&
position[
#{
line_type
}
]=
#{
line_count
*
100
}
&
position[head_sha]=
#{
head_sha
}
&
position[start_sha]=
#{
start_sha
}
&
position[base_sha]=
#{
base_sha
}
"""
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