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

Update system tests to handle zstd:chunked images #24286

Merged
merged 5 commits into from
Oct 22, 2024

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Oct 15, 2024

  • Compare image configs, not IDs, when checking image identity from different way of pulling them
  • Try to make the additional image store test a bit more robust
  • Remove an image identity assumption from the “load by URL” test.

Working on test failures as discussed in containers/storage#2130 .

At this point absolutely untested, and I don’t really know what I’m doing.

Cc: @edsantiago — perhaps read this only later after this is at least minimally shown to be working.

Does this PR introduce a user-facing change?

None

@openshift-ci openshift-ci bot added release-note-none do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Oct 15, 2024
Copy link
Contributor

openshift-ci bot commented Oct 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtrmac

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 15, 2024
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

Copy link
Collaborator Author

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is nowhere close to working, ignore for now.


Also [255] [email protected] template with rollback

#|     FAIL: global auto-update policy gets applied
   #| expected: '.*podman-kube@-tmp-podman_bats.roXH3U-test.yaml.service,.* (test_pod-a),quay.io/libpod/testimage:20241010,false,registry.*' (using expr)
   #|   actual: 'podman-kube@-tmp-podman_bats.roXH3U-test.yaml.service,c104ff383fd7 (test_pod-a),quay.io/libpod/testimage:20241010,pending,registry'
   #|         > 'podman-kube@-tmp-podman_bats.roXH3U-test.yaml.service,aa204347c263 (test_pod-b),localhost/image:Kl8NYi3jxL,false,local'

test/system/010-images.bats Outdated Show resolved Hide resolved
test/system/120-load.bats Show resolved Hide resolved
test/system/150-login.bats Outdated Show resolved Hide resolved
test/system/150-login.bats Outdated Show resolved Hide resolved
@mtrmac mtrmac force-pushed the compare-image-configs branch 8 times, most recently from 51edef6 to a644fe8 Compare October 17, 2024 21:21
@mtrmac
Copy link
Collaborator Author

mtrmac commented Oct 17, 2024

@edsantiago With this, make localsystem is passing for me in #24287 , and it should continue to work with non-chunked images.

Could you take a preliminary look to make sure I’m not missing/breaking the point of these tests, please?

See individual commit messages for details.

@mtrmac mtrmac changed the title FIXME Various zstd:chunked test changes Update system tests to handle zstd:chunked images Oct 17, 2024
@edsantiago
Copy link
Member

@mtrmac I've been peeking periodically and have seen no major cause for alarm. I will not be able to give this a thorough review until Monday. Apologies.

test/system/helpers.bash Outdated Show resolved Hide resolved
test/system/helpers.bash Outdated Show resolved Hide resolved
@mtrmac
Copy link
Collaborator Author

mtrmac commented Oct 17, 2024

@edsantiago Thanks! The peeks are reassuring already, and I need to make this pass first. There’s no rush at all.

Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the 120 tests need a complete revamp: my initial decision to use $IMAGE has backfired. Next week I will look into a different safer approach.

@mtrmac mtrmac force-pushed the compare-image-configs branch 2 times, most recently from 2832b1b to 4db012e Compare October 18, 2024 22:17
@mtrmac
Copy link
Collaborator Author

mtrmac commented Oct 18, 2024

Ready for review:
System tests are passing both here, with current images, and in #24287 , with zstd:chunked images. (Integration tests are failing with zstd:chunked images, I’ll work on that in a separate PR.)

@mtrmac mtrmac marked this pull request as ready for review October 18, 2024 22:58
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 18, 2024
Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion, one question-and-suggestion, none blockers.

The use of cd for config digest does weird things to my brain: I can't help but see it as change directory. That's indelibly hardwired and I'm actually a little amused by it. I can't propose a better alternative (except the unwieldy $config_digest, which I see is what skopeo uses in its own system tests) so I won't block on it. Just pointing out in case you're able to think of any better name.

Nice work. Thanks for the explanatory comments.


CONTAINERS_STORAGE_CONF=$sconf run_podman pull -q $IMAGE
is "$output" "$id" "pull -q $IMAGE, using storage.conf"
# This is originally a regression test, (podman pull) used to output multiple image IDs. Ensure it only prints one.
[[ $(printf '%s' "$output" | wc -l) -le 1 ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

    assert "${#lines[*]}" -le 1 "Number of output lines from podman pull"

Reason: the Bats [[ etc ]] tests generate error diagnostics that are ... sub-ideal. This is an assertion that must never fail, but even those (especially those?) deserve a way to help someone debug.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I completely forgot assert exists despite using it elsewhere.

Fixed as proposed.

# with zstd:chunked, the same image might have different IDs depending on whether
# creating layers happened based on the TOC (and per-file operations) or the full layer tarball
function image_config_digest() {
echo "image_config_digest $1" >&2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to leave these debug statements?

The printf | sha256sum below is subtle and potentially distracting; if you remove the debug statements, you could collapse everything down to

    local sha_output; sha_output=$(skopeo inspect --raw --config "containers-storage:$1" | sha256sum)
    # strip filename ("-") from sha output
    # echo "${sha_output%% *}"

I'm fine with leaving the debug statements in place for a few months, but if so please add a comment explaining when it might be safe to remove them, and explaining the reason for printf (preserving exact output without the additional newline that <<<"$config" would introduce)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the local mystery of #24286 (comment) , the most useful case of detecting broken inputs should be handled naturally; so I have dropped the logging.

# Removing the additional store underneath can result in dangling layer references.
# Try to fix that up.
CONTAINERS_STORAGE_CONF=$sconf run_podman rmi $IMAGE
_prefetch $IMAGE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me barf a little, but it's my fault for making bad assumptions in this test, and I pledge to clean it in a followup.

@mtrmac
Copy link
Collaborator Author

mtrmac commented Oct 21, 2024

The use of cd for config digest does weird things to my brain: I can't help but see it as change directory. That's indelibly hardwired and I'm actually a little amused by it. I can't propose a better alternative (except the unwieldy $config_digest,

I don’t mind long and verbose names, if they avoid confusion. So I’ll rename to config_digest if that’s OK.

The test got the stores RW status backwards.

Before zstd:chunked, both image IDs should be the same, so this used
to make no difference.

Signed-off-by: Miloslav Trmač <[email protected]>
When looking up the current-store image ID, do that
from the same output where we verify that the ID is from the
current store, instead of listing images twice.

Signed-off-by: Miloslav Trmač <[email protected]>
… methods

Historically, non-schema1 images had a deterministic image ID == config digest.
With zstd:chunked, we don't want to deduplicate layers pulled by consuming the
full tarball and layers partially pulled based on TOC, because we can't cheaply
ensure equivalence; so, image IDs for images where a TOC was used differ.

To accommodate that, compare images using their configs digests, not using image IDs.

Signed-off-by: Miloslav Trmač <[email protected]>
The additional image store feature assumes that images / layers
in the additional store never go away, while we do remove it after
this test. Try to repair the store.

Signed-off-by: Miloslav Trmač <[email protected]>
Don't assume that the loaded image will be deduplicated
with the server image.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac
Copy link
Collaborator Author

mtrmac commented Oct 22, 2024

Thanks for the review, updated (except for rearchitecting the “additional image store” test).

@edsantiago
Copy link
Member

...and I see that tests passed in #24287 as well. Thank you. Will try to re-review this afternoon after getting to a breaking point in other work.

@edsantiago
Copy link
Member

/lgtm

Nice work, thank you

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 22, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 410f796 into containers:main Oct 22, 2024
57 checks passed
@mtrmac mtrmac deleted the compare-image-configs branch October 22, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants