1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! shiguredo_container — macOS / Linux 両対応のテスト用コンテナ管理ライブラリ。
//!
//! macOS では Apple Container、Linux では Docker Engine API を利用してコンテナを管理する。
//! ユーザーは `use shiguredo_container::*` で両 OS 向けに同じ API を書ける。
//!
//! # クイックスタート
//!
//! alpine コンテナを起動してコマンドを実行し、終了後に削除する例。
//!
//! ```rust,no_run
//! use shiguredo_container::{AsyncRunner, ExecCommand, GenericImage, ImageExt};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // コンテナを起動し、`tail` で生存させ続ける
//! let container = GenericImage::new("alpine", "latest")
//! .with_cmd(["tail", "-f", "/dev/null"])
//! .start()
//! .await?;
//!
//! // コンテナ内でコマンドを実行する
//! let mut result = container.exec(ExecCommand::new(["echo", "hello"])).await?;
//! assert_eq!(result.exit_code().await?, Some(0));
//! let stdout = result.stdout_to_vec().await?;
//! assert_eq!(String::from_utf8_lossy(&stdout).trim(), "hello");
//!
//! // コンテナを削除する
//! container.rm().await?;
//! Ok(())
//! }
//! ```
//!
//! # Feature 一覧
//!
//! - `blocking`: 同期 API ([`Container`] / [`SyncRunner`]) を有効化する。
//! - `http_wait_plain`: [`WaitFor::http`] ([`core::wait::HttpWaitStrategy`]) を有効化する。plain HTTP のみ対応 (TLS 非対応)。
//! - `watchdog`: テストプロセスのクラッシュ (SIGKILL 含む) 時に孤立コンテナを掃除する。macOS のみ。
//!
//! # プラットフォーム差
//!
//! - macOS: Apple Container の XPC 経由でコンテナを管理する。pause / unpause は未対応。
//! - Linux: Docker Engine API 経由でコンテナを管理する。`with_ssh` は未対応。
//!
//! 対応範囲の詳細は `docs/TESTCONTAINERS.md` と README の WARNING を参照すること。
//!
//! # 環境変数
//!
//! - `TESTCONTAINERS_COMMAND`: `keep` を設定すると Drop 時にコンテナを削除しない (デバッグ用)。
pub
pub use crateError;
pub use crate;
pub use crateGenericImage;
pub use crateAsyncRunner;
pub use crateContainer;
pub use crateSyncRunner;