Skip to content

Commit

Permalink
pkg/utils: Support Fedora rawhide version name
Browse files Browse the repository at this point in the history
Since pulling the Fedora Rawhide image from
registry.fedoraproject.org/fedora/rawhide succeeds now, add support for
the Fedora Rawhide version name by allowing 'rawhide' to be passed as a
release argument.

Fixes: containers#646.
  • Loading branch information
rominf committed Aug 31, 2024
1 parent 67d4002 commit 0e0ade7
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ func parseReleaseArch(release string) (string, error) {
}

func parseReleaseFedora(release string) (string, error) {
if release == "rawhide" {
return release, nil
}

if strings.HasPrefix(release, "F") || strings.HasPrefix(release, "f") {
release = release[1:]
}
Expand Down
5 changes: 5 additions & 0 deletions src/pkg/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func TestParseRelease(t *testing.T) {
inputRelease: "foo",
errMsg: "The release must be 'latest'.",
},
{
inputDistro: "fedora",
inputRelease: "rawhide",
output: "rawhide",
},
{
inputDistro: "fedora",
inputRelease: "f34",
Expand Down
14 changes: 14 additions & 0 deletions test/system/101-create.bats
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ teardown() {
assert_output --regexp "Created[[:blank:]]+fedora-toolbox-34"
}

@test "create: Fedora rawhide" {
pull_distro_image fedora rawhide

run "$TOOLBX" --assumeyes create --distro fedora --release rawhide

assert_success
assert_output --partial "Created container: fedora-toolbox-rawhide"
assert_output --partial "Enter with: toolbox enter fedora-toolbox-rawhide"

run podman ps -a

assert_output --regexp "Created[[:blank:]]+fedora-toolbox-rawhide"
}

@test "create: RHEL 8.10" {
pull_distro_image rhel 8.10

Expand Down
10 changes: 10 additions & 0 deletions test/system/104-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ teardown() {
assert [ ${#stderr_lines[@]} -eq 0 ]
}

@test "run: Smoke test with Fedora rawhide" {
create_distro_container fedora rawhide fedora-toolbox-rawhide

run --separate-stderr "$TOOLBX" run --distro fedora --release rawhide true

assert_success
assert [ ${#lines[@]} -eq 0 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}

@test "run: Smoke test with RHEL 8.10" {
create_distro_container rhel 8.10 rhel-toolbox-8.10

Expand Down
1 change: 1 addition & 0 deletions test/system/setup_suite.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ setup_suite() {
# Cache all images that will be needed during the tests
_pull_and_cache_distro_image arch latest || false
_pull_and_cache_distro_image fedora 34 || false
_pull_and_cache_distro_image fedora rawhide || false
_pull_and_cache_distro_image rhel 8.10 || false
_pull_and_cache_distro_image ubuntu 16.04 || false
_pull_and_cache_distro_image ubuntu 18.04 || false
Expand Down

0 comments on commit 0e0ade7

Please sign in to comment.