Skip to content

Commit

Permalink
[#52286] frontend_tester: Added possibility to include header to term…
Browse files Browse the repository at this point in the history
…inal stress test

Signed-off-by: Grzegorz Latosinski <[email protected]>
  • Loading branch information
glatosinski committed Dec 7, 2023
1 parent 700174b commit 3d5ea50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"type": "integer",
"default": 10
},
{
"name": "AddMessageID",
"type": "bool",
"default": false
},
{
"name": "MessagesPerSecond",
"type": "number",
Expand Down
8 changes: 7 additions & 1 deletion pipeline_manager/frontend_tester/tester_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from typing import Dict, List, Union
import string
import sys
from datetime import datetime

from pipeline_manager import frontend_tester
from pipeline_manager.utils.logger import string_to_verbosity
Expand Down Expand Up @@ -385,6 +386,7 @@ async def _run_validate_response(
terminal_name = properties["TerminalName"]
message_length = properties["MessageLength"]
rate = properties["MessagesPerSecond"]
add_message_id = properties["AddMessageID"]

await self.client.notify(
'progress_change',
Expand All @@ -397,11 +399,15 @@ async def _run_validate_response(
list(string.ascii_uppercase + string.digits) + ['\r\n'],
k=message_length
))
if add_message_id:
curr_time = datetime.now().strftime("%H:%M:%S.%f")
random_message = f"\r\nMessage {counter} [{curr_time}] : {random_message}" # noqa: E501
await self.client.notify(
'terminal_write',
{
'name': terminal_name,
'message': f'{random_message}'}
'message': random_message
}
)
counter += 1
await asyncio.sleep(1 / rate)
Expand Down

0 comments on commit 3d5ea50

Please sign in to comment.