Skip to content

Commit

Permalink
fix(validate-script): socketio runtime schema max value (#2151)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardobridge authored Sep 19, 2023
1 parent 44b3aae commit 2c714fc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion examples/socket-io/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const io = require('socket.io')(8080, {
serveClient: false
});

io.on('connection', (socket) => {
const personalisedNamespace = io.of('/personalised');

personalisedNamespace.on('connection', (socket) => {
socket.on('echo', (msg) => {
socket.emit('echoResponse', msg);
});
Expand Down
8 changes: 5 additions & 3 deletions examples/socket-io/socket-io.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config:
target: "http://localhost:8080/"
target: "http://localhost:8080"
phases:
- duration: 60
arrivalRate: 25
Expand All @@ -8,7 +8,8 @@ scenarios:
- name: "Emit and validate response"
engine: socketio
flow:
- emit:
- namespace: /personalised
emit:
channel: "echo"
data: "Hello from Artillery"
response:
Expand All @@ -18,7 +19,8 @@ scenarios:
- name: "Emit and validate acknowledgement"
engine: socketio
flow:
- emit:
- namespace: /personalised
emit:
channel: "userDetails"
acknowledge:
match:
Expand Down
2 changes: 1 addition & 1 deletion packages/artillery/lib/util/validate-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const flowItemSchema = Joi.object({
}),
otherwise: Joi.when('...engine', {
is: Joi.exist().valid('socketio'),
then: Joi.object().max(2),
then: Joi.object().max(3),
otherwise: Joi.object().length(1)
})
});
Expand Down

0 comments on commit 2c714fc

Please sign in to comment.