-
Notifications
You must be signed in to change notification settings - Fork 4
/
.blackfire.yaml
158 lines (130 loc) · 4.69 KB
/
.blackfire.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
metrics:
wordpress.installed:
label: "Is WordPress installed?"
matching_calls:
php:
- callee: "=WP::main"
wordpress.get_option:
label: "WordPress get_option"
matching_calls:
php:
- callee:
selector: '=get_option'
argument:
1: '*'
wordpress.get_option.raw:
label: "WordPress get_option RAW (SQL query based)"
matching_calls:
php:
- callee:
selector: '=wpdb::query'
argument:
1: '/.+ from wp_options/'
contrib: "count-only"
wordpress.plugins_count:
label: "Count active plugins based on plugin_loaded hook"
matching_calls:
php:
- callee:
selector: "=do_action"
argument:
1: "=plugin_loaded"
2: "*"
wordpress.postdata_count:
label: "Count number of times setup_postdata is used"
matching_calls:
php:
- callee:
selector: "=WP_Query::setup_postdata"
wordpress.wp_query:
label: "WordPress wp_query"
timeline: true
matching_calls:
php:
- callee:
selector: '=WP_Query::query'
argument:
1: '*'
wordpress.found_rows:
label: "WordPress SQL_CALC_FOUND_ROWS"
matching_calls:
php:
- callee:
selector: '=wpdb::query'
argument:
1: '/.+ SQL_CALC_FOUND_ROWS/'
contrib: "count-only"
tests:
"The homepage should be fast":
path: "/"
assertions:
- "main.wall_time < 200ms"
"Number of calls to get_option should be reasonable":
path: "/.*"
assertions:
- "metrics.wordpress.get_option.count <= 50"
"The number of calls to wp_options table should be reasonable":
path: "/.*"
assertions:
- "metrics.wordpress.get_option.raw.count <= 25"
"Not too many SQL queries":
path: "/.*"
when: "metrics.wordpress.installed.count > 0"
assertions:
- "metrics.sql.queries.count <= 100"
"Regular plugins shouldn't take too long to load":
path: "/.*"
when: 'has_marker("wordpress.muplugins_loaded") and has_marker("wordpress.plugins_loaded")'
assertions:
# Should not exceed 50ms
- '(marker_time("wordpress.plugins_loaded") - marker_time("wordpress.muplugins_loaded")) <= 50ms'
# Should not exceed 10% of the wall_time
- '(marker_time("wordpress.plugins_loaded") - marker_time("wordpress.muplugins_loaded")) / main.wall_time < 0.1'
"Don't loop too many posts":
path: "/.*"
assertions:
- "metrics.wordpress.postdata_count.count <= 25"
"Counting found rows should be as limited as possible":
path: "/.*"
assertions:
- "metrics.wordpress.found_rows.count <= 5"
"Calls to WP_Query should stay limited":
path: "/.*"
assertions:
- "metrics.wordpress.wp_query.count <= 10"
# Read more about writing scenarios at https://blackfire.io/docs/builds-cookbooks/scenarios
scenarios: |
#!blackfire-player
name 'WordPress performance tests from CI'
scenario
name 'Basic pages'
visit url('/')
name 'Homepage'
expect status_code() == 200
visit url('/terms-of-service/')
name 'Terms of service'
expect status_code() == 200
click link('Sample Page')
name 'Sample Page'
expect status_code() == 200
scenario
name '2nd Article in the list'
visit url('/')
name 'Homepage'
blackfire false
click css('ul.wp-block-post-template > li:nth-child(2) a')
expect status_code() == 200
click css('.taxonomy-category a:nth-child(1)')
expect status_code() == 200
scenario
name 'Post a comment on the first article from the list'
visit url('/')
name 'Homepage'
blackfire false
expect status_code() == 200
click css('ul.wp-block-post-template > li:nth-child(1) a')
expect status_code() == 200
submit button('Post Comment')
param comment join(fake('paragraphs', 2), "\n\n")
param author 'Blackfire CI Bot'
param email '[email protected]'