mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00:00
Add a passing test for interactivity on slow pipelines (#12865)
# Description This PR adds a single test to assert interactivity on slow pipelines Currently the timeout is set to 6 seconds, as the test can sometimes take ~3secs to run on my local m1 mac air, which I don't think is an indication of a slow pipeline, but rather slow test start up time...
This commit is contained in:
parent
155934f783
commit
a7807735b1
1 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
use rstest::rstest;
|
||||
|
||||
use nu_test_support::nu_with_plugins;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
|
@ -190,3 +192,18 @@ fn generate_sequence() {
|
|||
|
||||
assert_eq!(actual.out, "[0,2,4,6,8,10]");
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[timeout(std::time::Duration::from_secs(6))]
|
||||
fn echo_interactivity_on_slow_pipelines() {
|
||||
// This test works by putting 0 on the upstream immediately, followed by 1 after 10 seconds.
|
||||
// If values aren't streamed to the plugin as they become available, `example echo` won't emit
|
||||
// anything until both 0 and 1 are available. The desired behavior is that `example echo` gets
|
||||
// the 0 immediately, which is consumed by `first`, allowing the pipeline to terminate early.
|
||||
let actual = nu_with_plugins!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
plugin: ("nu_plugin_example"),
|
||||
r#"[1] | each { |n| sleep 10sec; $n } | prepend 0 | example echo | first"#
|
||||
);
|
||||
assert_eq!(actual.out, "0");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue