Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
429d31f7
Commit
429d31f7
authored
Apr 02, 2023
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new Robot test for the quote server
parent
38414feb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
4 deletions
+99
-4
examples/web_socket/quote-server.cpp
examples/web_socket/quote-server.cpp
+4
-0
robot/CMakeLists.txt
robot/CMakeLists.txt
+9
-0
robot/dependencies.txt
robot/dependencies.txt
+1
-0
robot/http/rest.robot
robot/http/rest.robot
+4
-4
robot/web_socket/quote-server.robot
robot/web_socket/quote-server.robot
+81
-0
No files found.
examples/web_socket/quote-server.cpp
View file @
429d31f7
...
...
@@ -203,6 +203,10 @@ int caf_main(caf::actor_system& sys, const config& cfg) {
});
});
}))
.
route
(
"/status"
,
http
::
method
::
get
,
[](
http
::
responder
&
res
)
{
res
.
respond
(
http
::
status
::
no_content
);
})
// --(rst-switch_protocol-end)--
// Run with the configured routes.
.
start
();
...
...
robot/CMakeLists.txt
View file @
429d31f7
...
...
@@ -8,3 +8,12 @@ add_test(
--variable BINARY_PATH:$<TARGET_FILE:rest>
--variable SSL_PATH:
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/http/rest.robot"
)
add_test
(
NAME
"robot-web-socket-quote-server"
COMMAND
${
Python_EXECUTABLE
}
-m robot
--variable BINARY_PATH:$<TARGET_FILE:quote-server>
--variable SSL_PATH:
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/web_socket/quote-server.robot"
)
robot/dependencies.txt
View file @
429d31f7
obotframework-websocketclient
robotframework
robotframework-requests
robot/http/rest.robot
View file @
429d31f7
...
...
@@ -3,8 +3,8 @@ Documentation A test suite for examples/http/rest.hpp.
Library
Process
Library
RequestsLibrary
Suite Setup
Start Server
Suite Teardown
Stop Server
Suite Setup
Start Server
s
Suite Teardown
Stop Server
s
*** Variables ***
${HTTP_URL}
http://localhost:55501
...
...
@@ -48,7 +48,7 @@ HTTPS Test Delete Key Value Pair
Key Should Not Exist
${HTTPS_URL}
foo
*** Keywords ***
Start Server
Start Server
s
${res1}
=
Start Process
${BINARY_PATH}
-p
55501
Set Suite Variable
${http_server_process}
${res1}
${res2}
=
Start Process
${BINARY_PATH}
-p
55502
-k
${SSL_PATH}
/key.pem
-c
${SSL_PATH}
/cert.pem
...
...
@@ -56,7 +56,7 @@ Start Server
Wait Until Keyword Succeeds
5s
125ms
Check If HTTP Server Is Reachable
Wait Until Keyword Succeeds
5s
125ms
Check If HTTPS Server Is Reachable
Stop Server
Stop Server
s
Terminate Process
${http_server_process}
Terminate Process
${https_server_process}
...
...
robot/web_socket/quote-server.robot
0 → 100644
View file @
429d31f7
*** Settings ***
Documentation
A test suite for examples/web_socket/quote-server
Library
Collections
Library
Process
Library
RequestsLibrary
Library
WebSocketClient
Suite Setup
Start Servers
Suite Teardown
Stop Servers
*** Variables ***
${HTTP_URL}
http://localhost:55501
${HTTPS_URL}
https://localhost:55502
${WS_URL}
ws://localhost:55501/ws/quotes/seneca
${WSS_URL}
wss://localhost:55502/ws/quotes/seneca
${FRAME_COUNT}
${10}
${BINARY_PATH}
/path/to/the/server
${SSL_PATH}
/path/to/the/pem/files
@{QUOTES}
Luck is what happens when preparation meets opportunity.
...
All cruelty springs from weakness.
...
We suffer more often in imagination than in reality.
...
Difficulties strengthen the mind, as labor does the body.
...
If a man knows not to which port he sails, no wind is favorable.
...
It is the power of the mind to be unconquerable.
...
No man was ever wise by chance.
...
He suffers more than necessary, who suffers before it is necessary.
...
I shall never be ashamed of citing a bad author if the line is good.
...
Only time can heal what reason cannot.
*** Test Cases ***
Test WebSocket Server Quotes
[
Tags
]
WebSocket
${fd}
=
WebSocketClient.Connect
${WS_URL}
${received_strings}
=
Receive Frames
${fd}
${FRAME_COUNT}
WebSocketClient.Close
${fd}
Validate Frames
${received_strings}
Test WebSocket Over SSL Server Quotes
[
Tags
]
WebSocket
${ssl_arg}
=
Evaluate
{"cert_reqs": ssl.CERT_NONE}
${fd}
=
WebSocketClient.Connect
${WSS_URL}
sslopt=
${ssl_arg}
${received_strings}
=
Receive Frames
${fd}
${FRAME_COUNT}
WebSocketClient.Close
${fd}
Validate Frames
${received_strings}
*** Keywords ***
Start Servers
${res1}
=
Start Process
${BINARY_PATH}
-p
55501
Set Suite Variable
${ws_server_process}
${res1}
${res2}
=
Start Process
${BINARY_PATH}
-p
55502
-k
${SSL_PATH}
/key.pem
-c
${SSL_PATH}
/cert.pem
Set Suite Variable
${wss_server_process}
${res2}
Wait Until Keyword Succeeds
5s
125ms
Check If HTTP Server Is Reachable
Wait Until Keyword Succeeds
5s
125ms
Check If HTTPS Server Is Reachable
Stop Servers
Terminate Process
${ws_server_process}
Terminate Process
${wss_server_process}
Check If HTTP Server Is Reachable
Log
Try reaching
${HTTP_URL}
/status.
${resp}
=
GET
${HTTP_URL}
/status
expected_status=204
Check If HTTPS Server Is Reachable
Log
Try reaching
${HTTPS_URL}
/status.
${resp}
=
GET
${HTTPS_URL}
/status
expected_status=204
verify=
${False}
Receive Frames
[
Arguments
]
${fd}
${frame_count}
@{received_strings}
=
Create List
FOR
${i}
IN RANGE
${frame_count}
${frame}
=
WebSocketClient.Recv
${fd}
Append To List
${received_strings}
${frame}
END
[
Return
]
${received_strings}
Validate Frames
[
Arguments
]
${received_strings}
Log
Received:
${received_strings}
.
${count}
=
Get Length
${received_strings}
Should Be Equal As Integers
${count}
${FRAME_COUNT}
Lists Should Be Equal
${received_strings}
${QUOTES}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment