Skip to content

Commit

Permalink
Add MG test to test the flag change in setup connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Shourya742 authored and lorbax committed Jul 10, 2024
1 parent 140ed7c commit 10b0c37
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/message-generator/messages/common_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@
},
"id": "setup_connection_job_declarator"
},
{
"message": {
"type": "SetupConnection",
"protocol": 1,
"min_version": 2,
"max_version": 2,
"flags": 6,
"endpoint_host": "",
"endpoint_port": 0,
"vendor": "",
"hardware_version": "",
"firmware": "",
"device_id": ""
},
"id": "setup_connection_job_declarator_with_no_async_flag"
},
{
"message": {
"type": "SetupConnectionSuccess",
Expand Down
38 changes: 38 additions & 0 deletions test/message-generator/mock/job-declarator-mock-invalid-flag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version": "2",
"doc": [
"This test does",
"Soft mock of JD",
"Connect to JDS",
"Receive Setup Connection Error as incorrect bits are set"
],
"frame_builders": [
{
"type": "automatic",
"message_id": "test/message-generator/messages/common_messages.json::setup_connection_job_declarator_with_no_async_flag"
}
],
"actions": [
{
"message_ids": ["setup_connection_job_declarator_with_no_async_flag"],
"role": "client",
"results": [
{
"type": "match_message_type",
"value": "0x01"
}

],
"actiondoc": "This action sends SetupConnection and checks that .Success"
}
],
"setup_commands": [],
"execution_commands": [],
"cleanup_commands": [],
"role": "client",
"downstream": {
"ip": "127.0.0.1",
"port": 34264,
"pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"version": "2",
"doc": [
"This test does",
"Launch the jd-server"
],
"frame_builders": [
],
"actions": [
],
"setup_commands": [
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"jd_server",
"--",
"-c",
"../test/config/jds-do-not-fail-on-wrong-txdatasucc/jds-config.toml"
],
"conditions": {
"WithConditions": {
"conditions": [
{
"output_string": "JD INITIALIZED",
"output_location": "StdOut",
"late_condition": false,
"condition": true
}
],
"timer_secs": 300,
"warn_no_panic": false
}
}
},
{
"command": "cargo",
"args": [
"run",
"../../test/message-generator/mock/job-declarator-mock-invalid-flag.json"
],
"conditions": {
"WithConditions": {
"conditions": [
{
"output_string": "MATCHED MESSAGE TYPE 1",
"output_location": "StdOut",
"late_condition": false,
"condition": true
}
],
"timer_secs": 600,
"warn_no_panic": false
}
}
}
],
"execution_commands": [
],
"cleanup_commands": [
{
"command": "pkill",
"args": ["-f", "jd_server", "-SIGINT"],
"conditions": "None"
}
],
"role": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/job-declarator-flag-test/job-declarator-flag-test.json || { echo 'mg test failed' ; exit 1; }

sleep 10

0 comments on commit 10b0c37

Please sign in to comment.