-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix MG tests for JD SetupConnection flags
as already described in the previous commit, we introduced a new JDS config parameter (`async_mining_allowed`) so now, we need 2 separate tests: - a JDS that supports async jobs - a JDS that does not support async jobs and for each test, we need a mock that: - sends a `SetupConnection` with flag 0 and asserts the expected outcome - sends a `SetupConnection` with flag 1 and asserts the expected outcome if JDS does not support async jobs and receives a `SetupConnection` with flag 1, the expected outcome is `SetupConnection.Error` in all other cases, the expected outcome is a `SetupConnection.Success` with the same flag as the original `SetupConnection`
- Loading branch information
Showing
9 changed files
with
244 additions
and
10 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...etup-connection-flag-test/jds-config.toml → ...g-test/jds-config-with-async-support.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/config/jds-setupconnection-flag-test/jds-config-without-async-support.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Async Job Support | ||
async_mining_allowed = false | ||
|
||
# SRI Pool config | ||
authority_public_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" | ||
authority_secret_key = "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n" | ||
cert_validity_sec = 3600 | ||
|
||
# list of compressed or uncompressed pubkeys for coinbase payout (only supports 1 item in the array at this point) | ||
coinbase_outputs = [ | ||
{ output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, | ||
] | ||
|
||
listen_jd_address = "127.0.0.1:34264" | ||
|
||
core_rpc_url = "" | ||
core_rpc_port = 18332 | ||
core_rpc_user = "" | ||
core_rpc_pass = "" | ||
# Time interval used for JDS mempool update | ||
[mempool_update_interval] | ||
unit = "secs" | ||
value = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
test/message-generator/mock/jdc-mock-flag-1-for-jds-setupconnection-with-async-support.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"version": "2", | ||
"doc": [ | ||
"This test does", | ||
"Soft mock of JDC", | ||
"Connect to JDS (that supports async jobs)", | ||
"Send SetupConnection with flag 1 (async jobs) and expect SetupConnection.Success with flag 1" | ||
], | ||
"frame_builders": [ | ||
{ | ||
"type": "automatic", | ||
"message_id": "test/message-generator/messages/common_messages.json::setup_connection_job_declarator" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"message_ids": ["setup_connection_job_declarator"], | ||
"role": "client", | ||
"results": [ | ||
{ | ||
"type": "match_message_field", | ||
"value": [ | ||
"CommonMessages", | ||
"SetupConnectionSuccess", | ||
[ | ||
[ | ||
"flags", | ||
{ "U32": 1 } | ||
] | ||
] | ||
] | ||
} | ||
], | ||
"actiondoc": "This action sends SetupConnection and expects SetupConnection.Success with flag 1" | ||
} | ||
], | ||
"setup_commands": [], | ||
"execution_commands": [], | ||
"cleanup_commands": [], | ||
"role": "client", | ||
"downstream": { | ||
"ip": "127.0.0.1", | ||
"port": 34264, | ||
"pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...message-generator/mock/jdc-mock-flag-1-for-jds-setupconnection-without-async-support.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"version": "2", | ||
"doc": [ | ||
"This test does", | ||
"Soft mock of JDC", | ||
"Connect to JDS (that does not support async jobs)", | ||
"Send SetupConnection with flag 1 (async jobs) and expect SetupConnection.Error" | ||
], | ||
"frame_builders": [ | ||
{ | ||
"type": "automatic", | ||
"message_id": "test/message-generator/messages/common_messages.json::setup_connection_job_declarator" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"message_ids": ["setup_connection_job_declarator"], | ||
"role": "client", | ||
"results": [ | ||
{ | ||
"type": "match_message_type", | ||
"value": "0x02" | ||
}, | ||
{ | ||
"type": "close_connection" | ||
} | ||
], | ||
"actiondoc": "This action sends SetupConnection and expects SetupConnection.Error" | ||
} | ||
], | ||
"setup_commands": [], | ||
"execution_commands": [], | ||
"cleanup_commands": [], | ||
"role": "client", | ||
"downstream": { | ||
"ip": "127.0.0.1", | ||
"port": 34264, | ||
"pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
.../jds-setupconnection-without-async-support/jds-setupconnection-without-async-support.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"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-setupconnection-flag-test/jds-config-without-async-support.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/jdc-mock-flag-0-for-jds-setupconnection-tests.json" | ||
], | ||
"conditions": { | ||
"WithConditions": { | ||
"conditions": [ | ||
{ | ||
"output_string": "TEST FAILED", | ||
"output_location": "StdErr", | ||
"late_condition": false, | ||
"condition": false | ||
} | ||
], | ||
"timer_secs": 600, | ||
"warn_no_panic": false | ||
} | ||
} | ||
}, | ||
{ | ||
"command": "cargo", | ||
"args": [ | ||
"run", | ||
"../../test/message-generator/mock/jdc-mock-flag-1-for-jds-setupconnection-without-async-support.json" | ||
], | ||
"conditions": { | ||
"WithConditions": { | ||
"conditions": [ | ||
{ | ||
"output_string": "TEST FAILED", | ||
"output_location": "StdErr", | ||
"late_condition": false, | ||
"condition": false | ||
} | ||
], | ||
"timer_secs": 600, | ||
"warn_no_panic": false | ||
} | ||
} | ||
} | ||
], | ||
"execution_commands": [ | ||
], | ||
"cleanup_commands": [ | ||
{ | ||
"command": "pkill", | ||
"args": ["-f", "jd_server", "-SIGINT"], | ||
"conditions": "None" | ||
} | ||
], | ||
"role": "none" | ||
} |
9 changes: 9 additions & 0 deletions
9
...st/jds-setupconnection-without-async-support/jds-setupconnection-without-async-support.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/jds-setupconnection-without-async-support/jds-setupconnection-without-async-support.json || { echo 'mg test failed' ; exit 1; } | ||
|
||
sleep 10 |