fixing bugs around the build feature

image to build in the tests is also moved to Fedora 38 as the Fedora 39
file doesn't work at the time of writing

Signed-off-by: Kilian Hanich <khanich.opensource@gmx.de>
This commit is contained in:
Kilian Hanich 2024-03-11 22:52:35 +01:00
parent 6e58a0d525
commit b56a4ccf63
2 changed files with 20 additions and 16 deletions

View File

@ -39,7 +39,7 @@ func RunContext(ctx context.Context, name string, stdin io.Reader, stdout, stder
return err return err
} }
if exitCode != 0 { if exitCode != 0 {
return fmt.Errorf("failed to invoke %s(1)", name) return fmt.Errorf("failed to invoke %s(%d)", name, exitCode)
} }
return nil return nil
} }

View File

@ -843,10 +843,13 @@ teardown() {
} }
@test "create: Build an image before creating the toolbox" { @test "create: Build an image before creating the toolbox" {
local build_context="./images/fedora/f39" local build_context="./images/fedora/f38"
run "$TOOLBX" create --build "$build_context" run "$TOOLBX" create --build "$build_context"
assert_success if [ "$status" -ne 0 ]
then
echo "$output"
fi
assert_line --index 0 "Created container: fedora-toolbox" assert_line --index 0 "Created container: fedora-toolbox"
assert_line --index 1 "Enter with: toolbox enter fedora-toolbox" assert_line --index 1 "Enter with: toolbox enter fedora-toolbox"
@ -858,33 +861,34 @@ teardown() {
} }
@test "create: Build an image and tag it before creating the toolbox without repository" { @test "create: Build an image and tag it before creating the toolbox without repository" {
local build_context="./images/fedora/f39" local build_context="./images/fedora/f38"
local build_tag="testbuild" local build_tag="testbuild"
run "$TOOLBX" create --build "&build_context" --build-tag "testbuild" run "$TOOLBX" create --build "$build_context" --build-tag "$build_tag"
assert_success assert_success
assert_line --index 0 "Created container: testbuild" assert_line --index 0 "Created container: $build_tag"
assert_line --index 1 "Enter with: toolbox enter testbuild" assert_line --index 1 "Enter with: toolbox enter $build_tag"
assert [ ${#lines[q]} -eq 2 ] assert [ ${#lines[@]} -eq 2 ]
run $PODMAN images --filter reference=localhost/testbuild run $PODMAN images --filter reference="localhost/$build_tag"
assert_success assert_success
assert [ ${#lines[@]} -eq 2 ] assert [ ${#lines[@]} -eq 2 ]
} }
@test "create: Build an image and tag it before creating the toolbox with repository" { @test "create: Build an image and tag it before creating the toolbox with repository" {
local build_context="./images/fedora/f39" local build_context="./images/fedora/f38"
local build_tag="registry.fedoraproject.org/testbuild" local tag_repository="registry.fedoraproject.org"
local build_tag="testbuild"
run "$TOOLBX" create --build "&build_context" --build-tag "testbuild" run "$TOOLBX" create --build "$build_context" --build-tag "$tag_repository/$build_tag"
assert_success assert_success
assert_line --index 0 "Created container: testbuild" assert_line --index 0 "Created container: $build_tag"
assert_line --index 1 "Enter with: toolbox enter testbuild" assert_line --index 1 "Enter with: toolbox enter $build_tag"
assert [ ${#lines[q]} -eq 2 ] assert [ ${#lines[@]} -eq 2 ]
run $PODMAN images --filter reference="$build_tag" run $PODMAN images --filter reference="$tag_repository/$build_tag"
assert_success assert_success
assert [ ${#lines[@]} -eq 2 ] assert [ ${#lines[@]} -eq 2 ]
} }