Skip to content

Commit

Permalink
Finalize release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ptejada committed Jun 10, 2023
1 parent 8a4b603 commit 8669670
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 139 deletions.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.2.0] - 2023-06-10
### Added
- Added new `connect` action to provide greater control over WS connection during the scenario flow.

Expand All @@ -13,7 +15,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changes
- The connection to the Socket.IO server will be made only when needed instead of during staging phase for the scenario.
- Instead of tracking the Websocket messages with code 0 in the Summary of an execution it will now appear as 101.
- Instead of tracking the Websocket messages with code 0 in the Summary of an execution it will now appear as 101.

### Deprecated

- Deprecates `scenario.flow.*.acknowledge.data`. Use `scenario.flow.*.acknowledge.data` instead.
- Deprecates `scenario.flow.*.emit.channel`. Equivalent to the first array element for `scenario.flow.*.emit`.
- Deprecates `scenario.flow.*.emit.data`. Equivalent to the second array element for `scenario.flow.*.emit`.
- Deprecates `scenario.flow.*.beforeRequest`. Use `scenario.flow.*.connect` instead to establish any new connection to
server. For everything else use a standalone `scenario.flow.*.function` action.
- Deprecates `scenario.flow.*.response.data`. Use `scenario.flow.*.response.args` instead.
- Deprecates `scenario.flow.*.reconnect`. Instead use `scenario.flow.*.connect` to establish a new connection to server.

## [1.1.2] - 2021-08-29
### Added
Expand All @@ -34,7 +46,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for configuring the Socket.IO client options under `config.engines.socketio-v3`
- `acknowledge.args` as an alias of `acknowledge.data`. This is used to match the exact params of the ack function.

[Unreleased]: https://github.com/ptejada/artillery-engine-socketio-v3/compare/v1.1.2...HEAD
[Unreleased]: https://github.com/ptejada/artillery-engine-socketio-v3/compare/v1.2.0...HEAD
[1.2.0]: https://github.com//ptejada/artillery-engine-socketio-v3/compare/v1.1.2...v1.2.0
[1.1.2]: https://github.com//ptejada/artillery-engine-socketio-v3/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com//ptejada/artillery-engine-socketio-v3/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com//ptejada/artillery-engine-socketio-v3/compare/v1.0.1...v1.1.0
49 changes: 23 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

Socket.IO v3 & v4 engine for Artillery.

### This document reflects the latest unreleased changes. For the last release documentation see [1.1.2 Docs]

### Disclaimer
In addition to upgrading the Socket.IO lib to version 3/4 this engine also modifies the original YML API documented at
[artillery.io](https://artillery.io/docs/guides/guides/socketio-reference.html#emit).
Expand Down Expand Up @@ -97,32 +95,31 @@ scenarios:
|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `config.socketio.*` | Set any Socket.IO [Client options]. |
| `scenario.flow.*.emit` | Array of arguments to send to the server. The first item in the list is usually referred as the event name while everything else following are additional arguments. |
| `scenario.flow.*.connect` | Overwrites any [Client options] from `config.socketio.*` and starts a new Socket.IO connection. |
| `scenario.flow.*.namespace` | Optional Socket.IO namespace to use alongside `emit` and `connect`. |
| `scenario.flow.*.response` | Object defining how to handle a following event following for an `emit` action. |
| `scenario.flow.*.response.on` | The name of the event to listen to. |
| `scenario.flow.*.response.capture` | Define logic to capture or remember a value from the event. This can be object or an array of objects. |
| `scenario.flow.*.response.capture.json` | JSON path to capture or remember. Ex `$.0.token` reference token in this document `[{"token": "..."}]`. |
| `scenario.flow.*.response.capture.as` | The name how the captured value will be remembered as. |
| `scenario.flow.*.response.args` | Assert the response asserts the object defined in this option. |
| `scenario.flow.*.response.match` | Asserts the response match specific values from a json document. This can be an object or an array of objects. |
| `scenario.flow.*.response.match.json` | JSON path to read the expected value from. |
| `scenario.flow.*.response.match.value` | The expected value at the JSON path. |
| `scenario.flow.*.acknowledge` | An object defining how to handle an `ack` response from Socket.IO |
| `scenario.flow.*.acknowledge.args` | Has the same behavior as `scenario.flow.*.response.args`. |
| `scenario.flow.*.acknowledge.capture` | Accepts same options as `scenario.flow.*.response.capture`. |
| `scenario.flow.*.acknowledge.match` | Accepts same options as `scenario.flow.*.response.match`. |
| `scenario.flow.*.think` | Number of seconds to wait. |
| `scenario.flow.*.jitter` | Option to be used with `think`. This option expects a value in milliseconds serves as random +- to offset the original `think` value |
| `scenario.flow.*.get` | Performs an HTTP GET request. See [Testing HTTP] for more info. |
| `scenario.flow.*.post` | Performs an HTTP POST request. See [Testing HTTP] for more info. |
| `scenario.flow.*.acknowledge.data` | \[DEPRECATED] Use `args` instead. |
| `scenario.flow.*.emit.channel` | \[DEPRECATED] Equivalent to `emit[0]`. |
| `scenario.flow.*.emit.data` | \[DEPRECATED] Equivalent to `emit[1]`. |
| `scenario.flow.*.emit.data` | \[DEPRECATED] Equivalent to `emit[1]`. |
| `scenatio.flow.*.connect` | Overwrites any [Client options] from `config.socketio.*` and starts a new Socket.IO connection. |
| `scenatio.flow.*.namespace` | Optional Socket.IO namespace to use alongside `emit` and `connect`. |
| `scenatio.flow.*.response` | Object defining how to handle a following event following for an `emit` action. |
| `scenatio.flow.*.response.on` | The name of the event to listen to. |
| `scenatio.flow.*.response.capture` | Define logic to capture or remember a value from the event. This can be object or an array of objects. |
| `scenatio.flow.*.response.capture.json` | JSON path to capture or remember. Ex `$.0.token` reference token in this document `[{"token": "..."}]`. |
| `scenatio.flow.*.response.capture.as` | The name how the captured value will be remembered as. |
| `scenatio.flow.*.response.args` | Assert the response asserts the object defined in this option. |
| `scenatio.flow.*.response.data` | \[DEPRECATED] Use `args` instead. |
| `scenatio.flow.*.response.match` | Asserts the response match specific values from a json document. This can be an object or an array of objects. |
| `scenatio.flow.*.response.match.json` | JSON path to read the expected value from. |
| `scenatio.flow.*.response.match.value` | The expected value at the JSON path. |
| `scenatio.flow.*.acknowledge` | An object defining how to handle an `ack` response from Socket.IO |
| `scenatio.flow.*.acknowledge.args` | Has the same behavior as `scenatio.flow.*.response.args`. |
| `scenatio.flow.*.acknowledge.data` | \[DEPRECATED] Use `args` instead. |
| `scenatio.flow.*.acknowledge.capture` | Accepts same options as `scenatio.flow.*.response.capture`. |
| `scenatio.flow.*.acknowledge.match` | Accepts same options as `scenatio.flow.*.response.match`. |
| `scenatio.flow.*.think` | Number of seconds to wait. |
| `scenatio.flow.*.jitter` | Option to be used with `think`. This option expects a value in milliseconds serves as random +- to offset the original `think` value |
| `scenatio.flow.*.get` | Performs an HTTP GET request. See [Testing HTTP] for more info. |
| `scenatio.flow.*.post` | Performs an HTTP POST request. See [Testing HTTP] for more info. |
| `scenatio.flow.*.beforeRequest` | \[DEPRECATED] Instead use `connect` to establish any new connection to server. For everything else use a standalone `function` action. |
| `scenatio.flow.*.reconnect` | \[DEPRECATED] Instead use `connect` to establish a new connection to server. |
| `scenario.flow.*.beforeRequest` | \[DEPRECATED] Use `connect` instead to establish any new connection to server. For everything else use a standalone `function` action. |
| `scenario.flow.*.response.data` | \[DEPRECATED] Use `args` instead. |
| `scenario.flow.*.reconnect` | \[DEPRECATED] Instead use `connect` to establish a new connection to server. |

### Example Scenario

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "artillery-engine-socketio-v3",
"version": "1.1.2",
"version": "1.2.0",
"description": "Socket.IO v3 engine for Artillery",
"main": "index.js",
"engines": {
Expand Down
107 changes: 0 additions & 107 deletions test-app/artillery.yml

This file was deleted.

3 changes: 1 addition & 2 deletions test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"license": "MIT",
"private": true,
"scripts": {
"test-new": "PORT=3009 node test.js",
"test": "DEBUG=socketio SERVER_PORT=\"${PORT:-3009}\" artillery run artillery.yml"
"test": "PORT=3009 node test.js"
},
"dependencies": {
"artillery": "^1.6.1",
Expand Down
7 changes: 7 additions & 0 deletions test-app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ io.of('secured').on('connection', function(socket) {
})

io.of('inspect').on('connection', (socket) => {
socket.onAny(function(...params) {
const ack = params.pop()

if (typeof ack === 'function') {
ack(...params)
}
})
socket.emit('result', {
headers: socket.request.headers,
query: socket.request.query
Expand Down
2 changes: 1 addition & 1 deletion test-app/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ scenarioFiles.forEach((fileName) => {
const file = `artillery/${fileName}`

try {
const result = execSync(`SERVER_PORT=${port++} npx artillery run ${file}`).toString();
const result = execSync(`DEBUG=socketio SERVER_PORT=${port++} npx artillery run ${file}`).toString();

errors = errors.concat(validateResult(fileName, result))
console.log(result)
Expand Down

0 comments on commit 8669670

Please sign in to comment.