Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement on basic_setup() of helpers of test/system (Clean up phase) #9930

Closed
aliaslanturk opened this issue Apr 3, 2021 · 8 comments
Closed
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue

Comments

@aliaslanturk
Copy link

aliaslanturk commented Apr 3, 2021

/kind feature

This issue proposes an improvement on basic_setup() function of helpers in its clean up phase.

Current flow of the function

basic_setup() function includes following lines to clean up unnecessary images before running tests:

# Clean up all images except those desired
    found_needed_image=
    run_podman images --all --format '{{.Repository}}:{{.Tag}} {{.ID}}'
    for line in "${lines[@]}"; do
        set $line
        if [ "$1" == "$PODMAN_TEST_IMAGE_FQN" ]; then
            found_needed_image=1
        else 
            echo "# setup(): removing stray images $1 $2" >&3
            run_podman rmi --force "$1" >/dev/null 2>&1 || true
            run_podman rmi --force "$2" >/dev/null 2>&1 || true
        fi  
    done

The for loop iterates to find the test image and remove any other image if present. Removing part uses {{.Repository}}:{{.Tag}} and {{.ID}} keywords to feed podman rmi. First key (Repository:Tag) works fine. However, ID key causes a problem if the test image has been tagged before.

What happens?

When a system test (XXX-*.bats) uses default basic_setup(), test passes if normal conditions are present.
The problem occurs if the test image ($IMAGE/$PODMAN_TEST_IMAGE_FQN) was tagged before as in:
podman tag $IMAGE same_image_with:new-tag
Following output can be observed as a result of the failure :

# setup(): removing stray images localhost/same_image_with:new-tag 4abe85964f5c
not ok 1 podman info - basic test
# (from function `is' in file helpers.bash, line 417,
#  in test file 005-info.bats, line 26)
#   `is "$output" ".*$expect" "output includes '$expect'"' failed

Root cause

As far as I can trace it, the problem is caused by run_podman rmi --force "$2" >/dev/null 2>&1 || true which removes the test image since run_podman rmi --force "$1" >/dev/null 2>&1 || true already removed the new_tag.

An improvement can be provided to avoid this case. I have not find a flow that reproduces the problem naturally, yet.

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 3, 2021
@aliaslanturk
Copy link
Author

I would like to work on the issue. Due to some obligation, I cannot until early May. If the issue is to be solved, and assigned to me, I am more than happy to do so when I get back.

@rhatdan
Copy link
Member

rhatdan commented Apr 5, 2021

I have assigned it to you, I don't think anyone is going to grab it. Lots of other work to be done.
Thanks.

@aliaslanturk
Copy link
Author

Removing run_podman rmi --force "$2" >/dev/null 2>&1 || true would work. However, I will commit that change after being assured whether it serves a specific purpose or not.

@github-actions
Copy link

github-actions bot commented Jun 5, 2021

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jun 7, 2021

@edsantiago PTAL

@edsantiago
Copy link
Member

@aliaslanturk does #10008 address your concerns?

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 11, 2021

Since we never heard back, I am going to assume yes, Please reopen if I am mistaken.

@rhatdan rhatdan closed this as completed Jul 11, 2021
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue
Projects
None yet
Development

No branches or pull requests

4 participants