-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathartillery.yaml
135 lines (120 loc) · 3.68 KB
/
artillery.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
config:
target: http://localhost:4000
processor: ./scripts/artillery-helpers.js
phases:
- name: Run
duration: 600
arrivalRate: 20
scenarios:
- name: CompleteFlow
flow:
- function: setProbabilities
# Add an author
- post:
url: /graphql
capture:
json: $.data.addAuthor.id
as: newAuthorId
json:
operationName: AddAuthor
variables:
author:
name: Test New Author
query: 'mutation AddAuthor($author: AddAuthorInput!) { addAuthor(author: $author) { id name } }'
# Wait for the author add to complete
- think: 1
# Add a book
- post:
url: /graphql
capture:
json: $.data.addBook.id
as: newBookId
json:
operationName: AddBook
variables:
book:
title: Test New Book
authorId: '{{ newAuthorId }}'
query: 'mutation AddBook($book: AddBookInput!) { addBook(book: $book) { id title author { id name } } }'
# Wait for the book add to complete
- think: 1
# Fetch all authors
- post:
url: /graphql
json:
operationName: Authors
variables:
query: 'query Authors { authors { id name books { id title } } }'
# Fetch one author
- post:
url: /graphql
json:
operationName: Author
variables:
id: '{{ newAuthorId }}'
query: 'query Author($id: ID!) { author(id: $id) { id name books { id title } } }'
# Fetch all books
- post:
url: /graphql
json:
operationName: Books
variables:
query: 'query Books { books { id title author { id name } } }'
# Fetch one book
- post:
url: /graphql
json:
operationName: Book
variables:
id: '{{ newBookId }}'
query: 'query Book($id: ID!) { book(id: $id) { id title author { id name } } }'
# Delete one book
- post:
url: /graphql
json:
operationName: DeleteBook
variables:
bookId: '{{ newBookId }}'
query: 'mutation DeleteBook($bookId: ID!) { deleteBook(bookId: $bookId) }'
# Delete one author
- post:
url: /graphql
json:
operationName: DeleteAuthor
variables:
authorId: '{{ newAuthorId }}'
query: 'mutation DeleteAuthor($authorId: ID!) { deleteAuthor(authorId: $authorId) }'
# Invalid field on named query
- post:
url: /graphql
ifTrue: runInvalidFieldNamed
json:
operationName: InvalidField
variables:
query: 'query InvalidField { authors { id test } }'
# Not found on named query
- post:
url: /graphql
ifTrue: runNotFoundNamed
json:
operationName: NotFound
variables:
id: '{{ newAuthorId }}'
query: 'query NotFound($id: ID!) { author(id: $id) { id } }'
# Invalid field on unnamed query
- post:
url: /graphql
ifTrue: runInvalidFieldUnnamed
json:
operationName: null
variables:
query: 'query { authors { id test } }'
# Not found on unnamed query
- post:
url: /graphql
ifTrue: runNotFoundUnnamed
json:
operationName: null
variables:
id: '{{ newAuthorId }}'
query: 'query($id: ID!) { author(id: $id) { id } }'