Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 26, 2025

Problem

The TestExport function in image/export_test.go was failing because it was checking for the existence of a specific VERSION file (c28b9c2faac407005d4d657e49f372fb3579a47dd4e4d87d13e29edd1c912d5c/VERSION) in the exported tarball. However, this file is not present in standard image exports like hello-world.

The test failure occurred with the assertion:

assertion failed: found is false

Root Cause

When examining the exported tarball contents, the test logs showed that the export contains standard OCI format files:

  • blobs/sha256/... (blob files)
  • index.json
  • manifest.json
  • oci-layout

But it does not contain the hardcoded VERSION file that the test was looking for.

Solution

Changed the test to check for manifest.json instead, which is always present in valid OCI image exports according to the OCI specification. This makes the test robust and ensures it validates that a proper export was generated without relying on image-specific artifacts.

Before:

if hdr.Name == "c28b9c2faac407005d4d657e49f372fb3579a47dd4e4d87d13e29edd1c912d5c/VERSION" {
    found = true
    break
}

After:

if hdr.Name == "manifest.json" {
    found = true
    break
}

Testing

  • TestExport now passes successfully
  • ✅ All other tests in the image package continue to pass
  • ✅ The test properly validates that the export contains expected OCI format files

This fix ensures the test works with any standard Docker image export, not just specific images that might contain a VERSION file.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: cpuguy83 <799078+cpuguy83@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TestExport to check for manifest.json instead of VERSION file in image export test Fix TestExport to check for manifest.json instead of VERSION file Jun 26, 2025
Copilot AI requested a review from cpuguy83 June 26, 2025 20:23
@cpuguy83 cpuguy83 marked this pull request as ready for review June 26, 2025 20:46
@cpuguy83 cpuguy83 merged commit ff7e721 into master Jun 26, 2025
2 checks passed
@cpuguy83 cpuguy83 deleted the copilot/fix-a473cbb3-11df-4d0b-9490-5b50078c2c7f branch June 26, 2025 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants