-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration tests #8
Integration tests #8
Conversation
fcd3018
to
c20c779
Compare
tests/hydra.rs
Outdated
fn hydra_oura_stdout_scenario_1() -> TestResult { | ||
let tx_event = r#"{"event":"apply","point":{"hash":"84e657e3dd5241caac75b749195f78684023583736cc08b2896290ab","slot":7},"record":{"hex":"84a300d9010281825820f0a39560ea80ccc68e8dffb6a4a077c8927811f06c5d9058d0fa2d1a8d047d2000018282581d605e4e214a6addd337126b3a61faad5dfe1e4f14f637a8969e3a05eefd1a001e848082581d600d45f2b310a98e766cee2ab2f6756c91719bd7b35929cef058365b651a015ef3c00200a100d90102818258200f193a88190f6dace0a3db1e0e50797a6e28cd4b6e289260dc96b5a8d7934bf858401b13ee550f3167a1b94796f2a2f5e22d782d628336a7797c5b798f358fa564dbe92ea75a4e2449eb2cef59c097d8497545ef1e4ea441b88a481194323ae7c608f5f6"}}"#; | ||
let events = vec![ | ||
"PeerConnected".to_string(), | ||
"PeerConnected".to_string(), | ||
"Greetings".to_string(), | ||
"HeadIsInitializing".to_string(), | ||
"Committed".to_string(), | ||
"Committed".to_string(), | ||
"Committed".to_string(), | ||
"HeadIsOpen".to_string(), | ||
"TxValid".to_string(), | ||
tx_event.to_string(), | ||
"SnapshotConfirmed".to_string(), | ||
"HeadIsClosed".to_string(), | ||
"ReadyToFanout".to_string(), | ||
"HeadIsFinalized".to_string(), | ||
]; | ||
hydra_oura_stdout_test("tests/hydra/scenario_1.txt".to_string(), events) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried mutating the expectations: tweaking 1) tx binary, 2) tx event slot, 3) dropping an event, but the test appears to still pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now it signals when failing. nice catch.thanks
tests/hydra.rs
Outdated
predicates.push(predicate_fn.eval(json)); | ||
count += 1; | ||
} | ||
assert_eq!(predicates, vec![true; expected.len()]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off the top of my head, I find it odd that the oura_pipeline
is responsible for both capturing the output and performing the assertion. Did you consider returning the captured outputs in the result?
And — maybe we could check the output with something like goldenfile instead of assert_eq
if the output is deterministic? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added golden as suggested 👍
refining testing plus gitignore spawn cmd process and fix typo truncate log file make sure result of tests is taken into account clean redundant tests
981030d
to
ab725ec
Compare
- Use random TCP ports - Use random output files - Use goldenfile (has the practical UPDATE_GOLDENFILES=1 flag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful to have 👍 I created a PR with some tweaks to this PR #10
Tweak integration tests
There are two suites of tests to be added.
Here we use dedicated daemon.toml which produces json. Every run it is truncated to 0, but one can inspect how it looks like ->
tests/hydra/logs.txt