Some checks are pending
Rhai Tests / Run Rhai Tests (push) Waiting to run
- Add sal-virt package to the workspace members - Update MONOREPO_CONVERSION_PLAN.md to reflect the completion of sal-process and sal-virt packages - Update src/lib.rs to include sal-virt - Update src/postgresclient to use sal-virt instead of local virt module - Update tests to use sal-virt
68 lines
2.7 KiB
Plaintext
68 lines
2.7 KiB
Plaintext
// Test script for basic Buildah functionality
|
|
|
|
print("=== Buildah Basic Tests ===");
|
|
|
|
// Test 1: Create a new builder
|
|
print("\n--- Test 1: Create Builder ---");
|
|
let builder_result = bah_new("test-container", "alpine:latest");
|
|
|
|
if builder_result.is_err() {
|
|
print("⚠️ Buildah not available - skipping Buildah tests");
|
|
print("This is expected in CI/test environments without Buildah installed");
|
|
print("=== Buildah Tests Skipped ===");
|
|
} else {
|
|
let builder = builder_result.unwrap();
|
|
print(`✓ Created builder for container: ${builder.name}`);
|
|
print(`✓ Using image: ${builder.image}`);
|
|
|
|
// Test 2: Debug mode
|
|
print("\n--- Test 2: Debug Mode ---");
|
|
assert_true(!builder.debug_mode, "Debug mode should be false by default");
|
|
builder.debug_mode = true;
|
|
assert_true(builder.debug_mode, "Debug mode should be true after setting");
|
|
builder.debug_mode = false;
|
|
assert_true(!builder.debug_mode, "Debug mode should be false after resetting");
|
|
print("✓ Debug mode toggle works correctly");
|
|
|
|
// Test 3: Builder properties
|
|
print("\n--- Test 3: Builder Properties ---");
|
|
assert_true(builder.name == "test-container", "Builder name should match");
|
|
assert_true(builder.image == "alpine:latest", "Builder image should match");
|
|
print("✓ Builder properties are correct");
|
|
|
|
// Test 4: Container ID (should be empty for new builder)
|
|
print("\n--- Test 4: Container ID ---");
|
|
let container_id = builder.container_id;
|
|
assert_true(container_id == "", "Container ID should be empty for new builder");
|
|
print("✓ Container ID is empty for new builder");
|
|
|
|
// Test 5: List images (static method)
|
|
print("\n--- Test 5: List Images ---");
|
|
let images_result = images(builder);
|
|
if images_result.is_ok() {
|
|
let images = images_result.unwrap();
|
|
print(`✓ Retrieved ${images.len()} images from local storage`);
|
|
|
|
// If we have images, test their properties
|
|
if images.len() > 0 {
|
|
let first_image = images[0];
|
|
print(`✓ First image ID: ${first_image.id}`);
|
|
print(`✓ First image name: ${first_image.name}`);
|
|
print(`✓ First image size: ${first_image.size}`);
|
|
}
|
|
} else {
|
|
print("⚠️ Could not list images (may be expected in test environment)");
|
|
}
|
|
|
|
// Test 6: Error handling
|
|
print("\n--- Test 6: Error Handling ---");
|
|
let invalid_builder_result = bah_new("", "");
|
|
if invalid_builder_result.is_err() {
|
|
print("✓ Error handling works for invalid parameters");
|
|
} else {
|
|
print("⚠️ Expected error for invalid parameters, but got success");
|
|
}
|
|
|
|
print("\n=== All Buildah Basic Tests Completed ===");
|
|
}
|