forked from platformsh/demo-project
-
Notifications
You must be signed in to change notification settings - Fork 1
/
blackfire.yaml
77 lines (67 loc) · 2.68 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
# This is a sample .blackfire.yaml file created by Blackfire.
# You can read more about .blackfire.yaml here: https://blackfire.io/docs/cookbooks/tests
# metrics:
# app.user_activity_calculation:
# label: "User activity calculation"
# timeline: true
# marker: true
# matching_calls:
# python:
# - callee: '=bigfoot.models.User.get_recent_comments_count'
# tests:
# "The homepage should be fast":
# path: "/"
# assertions:
# - "main.wall_time < 100ms"
# "The homepage should not consume too much memory":
# path: "/"
# assertions:
# - "main.peak_memory < 2mb"
# "The number of created entities should be reasonable":
# path: "/.*"
# assertions:
# - "metrics.entities.created.count < 50"
# "The homepage should have a limited number of SQL queries":
# path: "/"
# assertions:
# - "metrics.sql.queries.count <= 5"
# For writing scenarios, take a look at the documentation
# https://blackfire.io/docs/cookbooks/scenarios
scenarios: |
#!blackfire-player
scenario
name "User visit"
set step "branch"
# local: change endpoint to localhost:3000
visit url("/")
name "Frontend branch"
expect status_code() == 200
# local: change endpoint to localhost:8000
visit url("/api/")
name "Backend base path"
expect status_code() == 200
expect body() == "Hello from the Python backend!"
visit url("/api/v1/environment")
name "Backend data"
expect status_code() == 200
# blackfire-player run blackfire.yml --endpoint="http://localhost:3000/" --variable step=branch -vvv
when "branch" == step
visit url("/api/v1/environment")
expect "file" == json("session_storage")
expect "production" == json("type")
when "redis" == step
visit url("/api/v1/environment")
expect "file" == json("session_storage")
expect "staging" == json("type")
when "merge-production" == step
visit url("/api/v1/environment")
expect "redis" == json("session_storage")
expect "staging" == json("type")
when "complete" == step
visit url("/api/v1/environment")
expect "redis" == json("session_storage")
expect "production" == json("type")
when "scale" == step
visit url("/api/v1/environment")
expect "redis" == json("session_storage")
expect "production" == json("type")