Issues with running the buildah tests #21

Open
opened 2025-07-02 15:08:06 +00:00 by maximevanhees · 0 comments
Member

Upon investigation it seems that the following tests were not executing correctly and/or giving false positives:

  • rhai_tests/buildah/01_builder_pattern.rhai
  • rhai_tests/buildah/02_image_operations.rhai
  • rhai_tests/buildah/03_container_operations.rhai
  • rhai_tests/buildah/run_all_tests.rhai

Each of these files uses has a is_buildah_available function at the beginning of the script to check for the presence of the buildah executable. As this function is inherently broken, none of the tests were able to get executed.

fn is_buildah_available() {
    try {
        let result = run("which buildah");
        return result.success;
    } catch(err) {
        return false;
    }
}

The run function gets registered to the engine upon the execution the of a test script using herodo. The run function is part of the process module, which gets registered when creating the engine (which gets done by herodo when executing a .rhai-script). The function itself only creates a RhaiCommandBuilder instance (registered as a CommandBuilder with the engine), but does not yet execute the command. For that, an additional .execute() call is required.

fn is_buildah_available() {
    try {
        let command = run("which buildah");
        let result = command.execute();
        return result.success;
    } catch(err) {
        return false;
    }
}

Fixing this (simple) bug lead to a chain of failing tests, which should -IMO- get fixed before continuing with #20.

Upon investigation it seems that the following tests were not executing correctly and/or giving false positives: - `rhai_tests/buildah/01_builder_pattern.rhai` - `rhai_tests/buildah/02_image_operations.rhai` - `rhai_tests/buildah/03_container_operations.rhai` - `rhai_tests/buildah/run_all_tests.rhai` Each of these files uses has a `is_buildah_available` function at the beginning of the script to check for the presence of the `buildah` executable. As this function is inherently broken, none of the tests were able to get executed. ```rhai fn is_buildah_available() { try { let result = run("which buildah"); return result.success; } catch(err) { return false; } } ``` The `run` function gets registered to the engine upon the execution the of a test script using `herodo`. The `run` function is part of the `process` module, which gets registered when creating the engine (which gets done by `herodo` when executing a `.rhai`-script). The function itself only creates a `RhaiCommandBuilder` instance (registered as a `CommandBuilder` with the engine), but does not yet execute the command. For that, an additional `.execute()` call is required. ```rhai fn is_buildah_available() { try { let command = run("which buildah"); let result = command.execute(); return result.success; } catch(err) { return false; } } ``` Fixing this (simple) bug lead to a chain of failing tests, which should -IMO- get fixed before continuing with https://git.ourworld.tf/herocode/sal/issues/20.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: herocode/sal#21
No description provided.