Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ custom = ["json"]

async = ["tokio", "async-trait", "futures"]
miette = ["dep:miette"]
sarge = ["dep:sarge"]
full = [
"json",
"yaml",
Expand Down Expand Up @@ -71,6 +72,7 @@ futures = { version = "0.3", optional = true }

# Error reporting (optional)
miette = { version = "7", optional = true }
sarge = { version = "9", optional = true }

[dev-dependencies]
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
Expand Down Expand Up @@ -101,6 +103,11 @@ name = "multiio_records_demo"
path = "src/bin/multiio_records_demo.rs"
required-features = ["csv"]

[[bin]]
name = "multiio_sarge"
path = "src/bin/multiio_sarge.rs"
required-features = ["json", "sarge"]

[[example]]
name = "basic_sync"
path = "examples/basic_sync.rs"
Expand Down
4 changes: 4 additions & 0 deletions e2e/data/input/xml_roundtrip/input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<root>
<a>1</a>
<b>two</b>
</root>
8 changes: 8 additions & 0 deletions e2e/data/output/baseline/xml_roundtrip/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"a": {
"$text": "1"
},
"b": {
"$text": "two"
}
}
19 changes: 19 additions & 0 deletions e2e/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ def multiio_records_demo_bin() -> Path:
return bin_path


@pytest.fixture(scope="session")
def multiio_sarge_bin() -> Path:
"""Ensure the multiio_sarge binary is built once per test session (sarge CLI demo)."""
root = project_root()
result = subprocess.run(
["cargo", "build", "--quiet", "--bin", "multiio_sarge", "--features", "full,sarge"],
cwd=root,
capture_output=True,
text=True,
)

assert result.returncode == 0, f"cargo build sarge failed: {result.stderr}"

bin_path = root / "target" / "debug" / "multiio_sarge"
assert bin_path.exists(), f"built sarge binary not found at {bin_path}"

return bin_path


def run_pipeline(
multiio_bin: Path,
pipeline_yaml_content: str,
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/test_features_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def project_root() -> Path:
"csv",
"xml",
"plaintext",
"sarge",
"async",
"miette",
"custom",
Expand Down
53 changes: 53 additions & 0 deletions e2e/tests/test_manual_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,56 @@ def test_manual_multi_in_one_out_json(tmp_path: Path, multiio_manual_bin: Path)

baseline_file = e2e / "data" / "output" / "baseline" / scenario / "output.json"
compare_json_files(output_file, baseline_file)


def test_manual_stdin_stdout_alias_tokens(tmp_path: Path, multiio_manual_bin: Path) -> None:
"""stdin/stdout aliases should behave like '-'."""
root = project_root()

stdin_values = [
{"name": "alice", "age": 30},
{"name": "bob", "age": 25},
]
stdin_data = json.dumps(stdin_values)

result = subprocess.run(
[str(multiio_manual_bin), "stdin", "stdout"],
cwd=root,
capture_output=True,
text=True,
input=stdin_data,
)

assert (
result.returncode == 0
), f"multiio_manual stdin/stdout aliases failed: {result.stderr}\nStdout: {result.stdout}"

output = json.loads(result.stdout)
assert output == stdin_values


def test_manual_writes_to_stderr(tmp_path: Path, multiio_manual_bin: Path) -> None:
"""stderr output token should write engine output to stderr."""
root = project_root()

stdin_values = [
{"name": "alice", "age": 30},
{"name": "bob", "age": 25},
]
stdin_data = json.dumps(stdin_values)

result = subprocess.run(
[str(multiio_manual_bin), "stdin", "stderr"],
cwd=root,
capture_output=True,
text=True,
input=stdin_data,
)

assert (
result.returncode == 0
), f"multiio_manual ->stderr failed: {result.stderr}\nStdout: {result.stdout}"
assert result.stdout == ""

output = json.loads(result.stderr)
assert output == stdin_values
Loading