mirror of
https://github.com/imjasonh/krust
synced 2026-07-08 06:45:32 +00:00
Initial commit: krust - container image build tool for Rust
krust builds container images for Rust applications without Docker: - Builds static binaries using musl libc - Creates minimal OCI container images - Pushes to any OCI-compliant registry - Outputs digest to stdout for composability Inspired by ko.build for Go applications. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
5e89023925
23 changed files with 1611 additions and 0 deletions
25
tests/e2e/basic_test.rs
Normal file
25
tests/e2e/basic_test.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
fn test_help_flag() {
|
||||
let output = Command::new("cargo")
|
||||
.args(&["run", "--", "--version"])
|
||||
.output()
|
||||
.expect("Failed to execute command");
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
assert!(stdout.contains("krust"));
|
||||
assert!(output.status.success());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_basic_run() {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.output()
|
||||
.expect("Failed to execute command");
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
assert!(stdout.contains("Hello from krust!"));
|
||||
assert!(output.status.success());
|
||||
}
|
||||
43
tests/integration_test.rs
Normal file
43
tests/integration_test.rs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
use anyhow::Result;
|
||||
use assert_cmd::Command;
|
||||
use predicates::prelude::*;
|
||||
|
||||
#[test]
|
||||
fn test_version_command() -> Result<()> {
|
||||
let mut cmd = Command::cargo_bin("krust")?;
|
||||
cmd.arg("--version");
|
||||
cmd.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("krust 0.1.0"));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_version_subcommand() -> Result<()> {
|
||||
let mut cmd = Command::cargo_bin("krust")?;
|
||||
cmd.arg("version");
|
||||
cmd.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("krust 0.1.0"));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_help_command() -> Result<()> {
|
||||
let mut cmd = Command::cargo_bin("krust")?;
|
||||
cmd.arg("--help");
|
||||
cmd.assert().success().stdout(predicate::str::contains(
|
||||
"A container image build tool for Rust applications",
|
||||
));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_build_help() -> Result<()> {
|
||||
let mut cmd = Command::cargo_bin("krust")?;
|
||||
cmd.arg("build").arg("--help");
|
||||
cmd.assert().success().stdout(predicate::str::contains(
|
||||
"Build a container image from a Rust application",
|
||||
));
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue