Skip to content

Commit

Permalink
Prepare for new release
Browse files Browse the repository at this point in the history
- Cleanup whitespaces
- Push to version V1.004
- Update README.md
- Update README.md for fuzzing and mass connection testing
- Include limits/performance test cases
- Exclude compression test cases
- Add massconnect.json
  • Loading branch information
Dadido3 committed Feb 11, 2021
1 parent 3c9cdb9 commit 59851ad
Show file tree
Hide file tree
Showing 6 changed files with 308 additions and 268 deletions.
42 changes: 21 additions & 21 deletions Fuzzing/Fuzzy_Server.pb
@@ -1,12 +1,12 @@
XIncludeFile "../Includes/WebSocket_Server.pbi"

Procedure WebSocket_Event(*Server, *Client, Event, *Event_Frame.WebSocket_Server::Event_Frame)
Protected Message.s
Protected Message.s
Select Event
Case WebSocket_Server::#Event_Connect
PrintN("Client connected: " + *Client)
Case WebSocket_Server::#Event_Disconnect
PrintN("Client disconnected: " + *Client)

Expand All @@ -18,26 +18,26 @@ Procedure WebSocket_Event(*Server, *Client, Event, *Event_Frame.WebSocket_Server

Case WebSocket_Server::#Opcode_Pong
PrintN(" Pong from: " + *Client)
Case WebSocket_Server::#Opcode_Connection_Close
PrintN(" Close request from: " + *Client)
Case WebSocket_Server::#Opcode_Connection_Close
PrintN(" Close request from: " + *Client)
Case WebSocket_Server::#Opcode_Text
Message = PeekS(*Event_Frame\Payload, *Event_Frame\Payload_Size, #PB_UTF8|#PB_ByteLength)
If Len(Message) >= 60
PrintN(" Echo message from: " + *Client + " (" + Left(Message, 60-3) + "...)")
Else
PrintN(" Echo message from: " + *Client + " (" + Message + ")")
EndIf
If CountString(Message, "�")
; #### Invalid string, disconnect client. This will cause another test case to fail. Best would be to have something that checks UTF-8 string for validity.
WebSocket_Server::Client_Disconnect(*Server, *Client, WebSocket_Server::#CloseStatusCode_1007)
Else
WebSocket_Server::Frame_Text_Send(*Server, *Client, Message)
EndIf
Message = PeekS(*Event_Frame\Payload, *Event_Frame\Payload_Size, #PB_UTF8|#PB_ByteLength)
If Len(Message) >= 60
PrintN(" Echo message from: " + *Client + " (" + Left(Message, 60-3) + "...)")
Else
PrintN(" Echo message from: " + *Client + " (" + Message + ")")
EndIf
If CountString(Message, "�")
; #### Invalid string, disconnect client. This will cause another test case to fail. Best would be to have something that checks UTF-8 string for validity.
WebSocket_Server::Client_Disconnect(*Server, *Client, WebSocket_Server::#CloseStatusCode_1007)
Else
WebSocket_Server::Frame_Text_Send(*Server, *Client, Message)
EndIf
Case WebSocket_Server::#Opcode_Binary
PrintN(" Echo binary from: " + *Client + " (" + *Event_Frame\Payload_Size + " bytes)")
PrintN(" Echo binary from: " + *Client + " (" + *Event_Frame\Payload_Size + " bytes)")
WebSocket_Server::Frame_Send(*Server, *Client, #True, 0, WebSocket_Server::#Opcode_Binary, *Event_Frame\Payload, *Event_Frame\Payload_Size)

EndSelect
Expand Down
17 changes: 14 additions & 3 deletions Fuzzing/README.md
@@ -1,8 +1,19 @@
# How to fuzzy test
# Using `Autobahn|Testsuite` for automated websocket server testing

## How to do a `fuzzing` test

1. Get docker
2. Download docker image for websocket fuzzing and load testing `docker pull crossbario/autobahn-testsuite`
2. Download docker image for websocket fuzzing and load testing: `docker pull crossbario/autobahn-testsuite`
3. Open cmd/shell/terminal inside of `.../WebSocket_Server/Fuzzying/`
4. Start the server
4. Start the `Fuzzy_Server.pb` server
5. Run `docker run -it --rm -v "${PWD}/config:/config" -v "${PWD}/reports:/reports" --name fuzzing --entrypoint=/bin/bash crossbario/autobahn-testsuite`
6. Enter `/usr/local/bin/wstest --mode fuzzingclient --spec /config/fuzzing-pb.json`

## How to do a `massconnect` test

1. Get docker
2. Download docker image for websocket fuzzing and load testing: `docker pull crossbario/autobahn-testsuite`
3. Open cmd/shell/terminal inside of `.../WebSocket_Server/Fuzzying/`
4. Start the `Fuzzy_Server.pb` server
5. Run `docker run -it --rm -v "${PWD}/config:/config" -v "${PWD}/reports:/reports" --name fuzzing --entrypoint=/bin/bash crossbario/autobahn-testsuite`
6. Enter `/usr/local/bin/wstest --mode massconnect --spec /config/massconnect.json`
2 changes: 1 addition & 1 deletion Fuzzing/config/fuzzing-pb.json
Expand Up @@ -6,6 +6,6 @@
}
],
"cases": ["*"],
"exclude-cases": ["9.*"],
"exclude-cases": ["12.*", "13.*"],
"exclude-agent-cases": {}
}
14 changes: 14 additions & 0 deletions Fuzzing/config/massconnect.json
@@ -0,0 +1,14 @@
{
"servers": [
{
"name": "PureBasic WebSocket server",
"uri": "ws://host.docker.internal:8090"
}
],
"options": {
"connections": 10000,
"batchsize": 100,
"batchdelay": 10,
"retrydelay": 10
}
}

0 comments on commit 59851ad

Please sign in to comment.