1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-07 22:35:25 +00:00

Ensure all tests run on all platforms without skipping

- Remove test skipping based on target availability
- Install cross-compilation toolchains for all platforms in CI:
  - Ubuntu: musl-tools
  - macOS: musl-cross with proper cargo config
  - Windows: rust-lld linker
- Update builder to use platform-appropriate linkers
- Make full build/run workflow test mandatory in CI
- Add Docker setup and local registry for integration tests
- Set RUSTFLAGS with --cfg ci to enable CI-specific test behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jason Hall 2025-06-07 21:17:30 -04:00
parent 93bb4561fc
commit 642472c548
Failed to extract signature
5 changed files with 71 additions and 23 deletions

View file

@ -4,6 +4,7 @@ use predicates::prelude::*;
use std::env;
use std::process::Command as StdCommand;
#[test]
fn test_version_command() -> Result<()> {
let mut cmd = Command::cargo_bin("krust")?;
@ -56,11 +57,9 @@ fn test_build_requires_repo_or_image() -> Result<()> {
.current_dir(&example_dir)
.env_remove("KRUST_REPO");
cmd.assert()
.failure()
.stderr(predicate::str::contains(
"Either --image or KRUST_REPO must be set",
));
cmd.assert().failure().stderr(predicate::str::contains(
"Either --image or KRUST_REPO must be set",
));
Ok(())
}
@ -76,11 +75,12 @@ fn test_build_with_krust_repo_env() -> Result<()> {
.env("KRUST_REPO", "test.local")
.current_dir(&example_dir);
cmd.assert().success().stderr(predicate::str::contains(
"Building Rust project",
)).stderr(predicate::str::contains(
"Successfully built image: test.local/hello-krust:latest",
));
cmd.assert()
.success()
.stderr(predicate::str::contains("Building Rust project"))
.stderr(predicate::str::contains(
"Successfully built image: test.local/hello-krust:latest",
));
Ok(())
}
@ -101,7 +101,10 @@ fn test_command_substitution_syntax() -> Result<()> {
// Stdout should be empty when --no-push is used
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(stdout.trim().is_empty(), "Stdout should be empty with --no-push");
assert!(
stdout.trim().is_empty(),
"Stdout should be empty with --no-push"
);
// Stderr should contain log messages
let stderr = String::from_utf8_lossy(&output.stderr);
@ -129,12 +132,11 @@ fn test_verbose_logging() -> Result<()> {
}
#[test]
#[ignore] // This test requires Docker and a registry
#[cfg_attr(not(ci), ignore)] // Run in CI, but allow skipping locally
fn test_full_build_and_run_workflow() -> Result<()> {
// Skip if Docker is not available
// This test requires Docker
if StdCommand::new("docker").arg("version").output().is_err() {
eprintln!("Skipping test: Docker not available");
return Ok(());
panic!("Docker is required for this test but is not available");
}
// Get the example project directory