vaultrs-test

Crates.iovaultrs-test
lib.rsvaultrs-test
version0.2.2
sourcesrc
created_at2021-09-09 02:19:05.251157
updated_at2021-09-11 18:20:10.772842
descriptionA test suite for testing against Hashicorp Vault servers.
homepage
repositoryhttps://github.com/jmgilman/vaultrs-test
max_upload_size
id448686
size13,929
Joshua Gilman (jmgilman)

documentation

README

vaultrs-test

A test suite for testing against Hashicorp Vault servers.

Installation

Add vaultrs-test as a developemnt depdendency to your cargo.toml:

[dev-dependencies]
vaultrs-test = "0.1.0"

Usage

use vaultrs_test::docker::{Server, ServerConfig};
use vaultrs_test::{VaultServer, VaultServerConfig};

// Configures a container to run Vault server v1.8.2
let config = VaultServerConfig::default(Some("1.8.2"));

// Creates a test instance to run the container in
let instance = config.to_instance();

// Runs the test instance, passing in details about the container environment
instance.run(|ops| async move {
    // The code below only runs after the container is verified running

    // Creates an abstraction for interacting with the Vault container
    let server = VaultServer::new(&ops, &config);

    // Run test code against container
})

// Container is cleaned up at this point

Testing

Run tests with cargo:

cargo test
Commit count: 0

cargo fmt