Skip to content

🧨 A easy to use and human-friendly DSL for conducting test assessments with INFINI Loadgen.

License

Notifications You must be signed in to change notification settings

infinilabs/loadgen-dsl

Repository files navigation

🚀 Loadgen DSL

The assertion DSL for Loadgen.

✍️ Example

loadgen-dsl compiles a little DSL to the yaml configuration of Loadgen.

# Build WASM module and run it from Golang
just run examples/example.dsl

Output:

and:
- equals:
    _ctx.response.body_json.name: lchynn
- range:
    _ctx.response.body_json.age:
      gte: -22.0
- equals:
    _ctx.response.body_json.com: infini
- or:
  - regexp:
      _ctx.response.body_json.team: dev.*
  - regexp:
      _ctx.response.body_json.team: doc.*
- and:
  - equals:
      _ctx.response.body_json.todo.pizza: inprogress
- equals:
    _ctx.response.body_json.todo.dsl: inprogress
- and:
  - equals:
      _ctx.response.body_json.likes.0: anime
  - equals:
      _ctx.response.body_json.likes.1: sports

🌲 Grammer

grammer    ::= brief | full
brief      ::= status? object EOF
full       ::= fields EOF
status     ::= integer
expr       ::= expr1 (infixop expr1)*
expr1      ::= literal
             | array
             | object
             | funcall
             | prefixop expr1
             | '(' exprlist ')'
exprlist   ::= (expr (',' expr)* ','?)?
object     ::= '{' fields '}'
fields     ::= (pair (',' pair)* ','?)?
pair       ::= path ':' expr
path       ::= key ('.' key)*
key        ::= name | string | integer
array      ::= '[' exprlist ']'
funcall    ::= name '(' exprlist ')'
literal    ::= null
             | boolean
             | integer
             | float
             | regex
             | string
ignore     ::= whitespace
              | comment
              /* ws: definition */

<?TOKENS?>

comment    ::= '//' char*
name       ::= ident - keyword
keyword    ::= 'null'
             | 'true'
             | 'false'
             | 'not'
             | 'and'
             | 'or'
ident      ::= id_start (id_start | '-' | digit)*
id_start   ::= [_a-zA-Z]
prefixop   ::= '-'
             | '>'
             | '<'
             | '>='
             | '<='
             | '=='
             | 'not'
infixop    ::= 'and' | 'or'
null       ::= 'null'
boolean    ::= 'true' | 'false'
integer    ::= digit+
exponent   ::= ('e' | 'E') ('+' | '-')? integer
float      ::= integer exponent
             | integer '.' integer exponent?
digit      ::= [0-9]
regex      ::= '/' ('\/' | char - '/')+ '/'
string     ::= '"' (escape | char - '"')* '"'
             | "'" (escape | char - "'")* "'"
escape     ::= '\b'
             | '\f'
             | '\n'
             | '\r'
             | '\t'
             | "\'"
             | '\"'
             | '\\'
             | '\/'
char       ::= #x9
             | [#x20-#xD7FF]
             | [#xE000-#xFFFD]
             | [#x10000-#x10FFFF]
whitespace ::= [#x9#xA#xD#x20]+
EOF        ::= $

References:

⚖️ License

Licensed under either of

at your option.

About

🧨 A easy to use and human-friendly DSL for conducting test assessments with INFINI Loadgen.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published