1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-18 06:56:13 +00:00

Fix flaky tests with temp directories and update documentation

This commit eliminates test flakiness by building to unique temporary
directories and updates the README to reflect all changes in this branch.

Code changes:
- Modified RustBuilder to use tempfile::tempdir() for each build
- Added BuildResult struct to keep temp directory alive during image build
- Each build now gets its own isolated target directory
- Removed clean_example_dir() and all cleanup logic - no longer needed
- Tests can now run concurrently without interfering with each other

Documentation updates:
- Added "Isolated builds" and "Concurrent builds" to key features
- Added comprehensive "Build Process" section explaining the temp directory approach
- Updated multi-arch documentation to reflect default behavior (builds both platforms)
- Added "Multi-Architecture Images" section explaining how multi-arch works
- Documented that manifest list support is planned for future release

Benefits:
- No more "Built binary not found" errors
- Tests run reliably every time
- Concurrent test execution is now safe
- Simpler test code without cleanup logic
- Clear documentation of build isolation

🤖 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 23:13:45 -04:00
parent 068ad65477
commit d4b7b216df
Failed to extract signature
5 changed files with 68 additions and 16 deletions

View file

@ -80,11 +80,14 @@ async fn main() -> Result<()> {
let builder =
RustBuilder::new(&project_path, &target).with_cargo_args(cargo_args.clone());
let binary_path = builder.build()?;
let build_result = builder.build()?;
// Build container image for this platform
let image_builder =
ImageBuilder::new(binary_path, base_image.clone(), platform_str.clone());
let image_builder = ImageBuilder::new(
build_result.binary_path,
base_image.clone(),
platform_str.clone(),
);
let (config_data, layer_data, manifest) = image_builder.build()?;