dogana

Crates.iodogana
lib.rsdogana
version0.1.0-1
created_at2025-04-23 11:19:28.524321+00
updated_at2025-04-23 11:19:28.524321+00
descriptionA simple framework to run integration tests of CLI projects inside a container
homepage
repositoryhttps://github.com/asperan/dogana
max_upload_size
id1645396
size48,212
Alex Speranza (asperan)

documentation

README

Dogana

Dogana is a rust library for running integration tests for CLI tools in containers.

Dogana divides the test in three phases:

  • Image build
  • Test environment initialization
  • CLI test run

Installation

Install this crate (as a dev dependency) with cargo:

cargo add --dev dogana

Configuration

This crate requires that all tested packages have a name and a version.

Optionally, you can specify the rust-version of your crate and Dogana will detect it.

Also, you can configure required packages for each image variant. To do so, refer to the crate documentation.

Usage

For each test that requires a container, create a tesst method which builds a DoganaTest:

use dogana::{
    dogana_images::DEBIAN_IMAGE,
    dogana_test::{builder::DoganaTestBuilder, test_options::DoganaTestOptions, DoganaTestResult},
};

#[test]
fn basic_integration_test() -> DoganaTestResult {
    DoganaTestBuilder::new()
        .set_test_options(DoganaTestOptions {
            keep_old_containers: true,
            ..Default::default()
        })
        .set_base_image(&DEBIAN_IMAGE)
        .set_run_commands(&["echo \"test\""])
        .set_expected_output("test")
        .build()
        .run()
}
Commit count: 7

cargo fmt