Skip to content

CLI testing harness for cuprated #469

Description

@hinto-janai

Note

TODO

What

CLI input/output testing harness for cuprated.

Why

Assert various output/behavior is as expected across time.

TODO: long-running output testing e.g. asserting Synchronised with the network is eventually emitted.

Where

Either /tests/cli or /binaries/cli.

Crate: cuprate-test-cli.

How

cuprate-test-cli:

trait CliTest {
    // e.g. `["--help"]`
    fn flags() -> &'static [&'static str];

    /// # Panics
    /// Allowed to panic if test fails.
    fn test(stdout: String, stderr: String);
}

/* impl various cli tests */

const CUPRATED: &str = "target/debug/cuprated"; // or elsewhere

fn main() {
    let cli_tests = todo!();

    for test in cli_tests {
        let output = std::process::Command::new("cmd")
            .args([[CUPRATED, test.flags()]].concat())
            .output()
            .unwrap();

        test.test(output.stdout, output.stderr);
    }
}

CI:

- name: CLI test
  run: cargo run --bin cuprate-test-cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-proposalCategory: A proposal of some kind, and a request for comments.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions