Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
28e2e77d
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
28e2e77d
编写于
4月 05, 2019
作者:
R
Ramya Authappan
提交者:
Sanad Liaquat
4月 05, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding perf testdata for MR diff tab
上级
9646e451
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
59 addition
and
8 deletion
+59
-8
qa/qa/tools/generate_perf_testdata.rb
qa/qa/tools/generate_perf_testdata.rb
+59
-8
未找到文件。
qa/qa/tools/generate_perf_testdata.rb
浏览文件 @
28e2e77d
...
...
@@ -33,6 +33,7 @@ module QA
add_new_file
methods_arr
=
[
method
(
:create_issues
),
method
(
:create_labels
),
method
(
:create_todos
),
method
(
:create_merge_requests
),
method
(
:create_issue_with_500_discussions
),
...
...
@@ -80,6 +81,15 @@ module QA
STDOUT
.
puts
"Created todos"
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
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
}
"
...
...
@@ -108,36 +118,77 @@ module QA
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
\"
"
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
}
"
STDOUT
.
puts
"Created Issue with 500 Discussions"
end
def
create_mr_with_large_files
content_arr
=
[]
20
.
times
do
|
i
|
16
.
times
do
|
i
|
faker_line_arr
=
Faker
::
Lorem
.
sentences
(
1500
)
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
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
)
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
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"
]
500
.
times
do
post
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/projects/
#{
@group_name
}
%2F
#{
@project_name
}
/merge_requests/
#{
iid
}
/discussions"
).
url
,
"body=
\"
Let us discuss
\"
"
diff_refs
=
JSON
.
parse
(
create_mr_response
.
body
)[
"diff_refs"
]
# 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
@urls
[
:large_mr
]
=
JSON
.
parse
(
create_mr_response
.
body
)[
"web_url"
]
STDOUT
.
puts
"Created MR with 500 Discussions and 20 Very Large Files"
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录