Skip to content

tests: cover the metadata file for multi exporter bake - #4081

Open
SaiPisey2 wants to merge 1 commit into
docker:masterfrom
SaiPisey2:test/bake-multi-exporter-metadata
Open

SaiPisey2 wants to merge 1 commit into
docker:masterfrom
SaiPisey2:test/bake-multi-exporter-metadata

Conversation

@SaiPisey2

Copy link
Copy Markdown

testBakeMultiExporters checks the registry, docker store and OCI outputs, but leaves the metadata file untested:

// TODO: test metadata file when supported by multi exporters https://github.com/docker/buildx/issues/2181

Multiple exporters are supported now, and a bake with image, docker and OCI outputs does write a metadata file, so this asserts buildx.build.ref and containerimage.digest from it.

image.name is deliberately not asserted. With several named exporters it still reports only one name, so it cannot stand in for the others. The TODO now records that narrower gap instead of pointing at multi exporter support in general.

Testing

The integration harness does not come up on my machine, on master as well as on this branch: it fails in lazyMirrorRunnerFunc before any test body runs, so I could not exercise testBakeMultiExporters itself.

What I did check was the behaviour the assertions depend on, by running a bake with the same shape of outputs against buildx 0.32.1:

$ docker buildx bake --metadata-file md.json \
    --set "*.output=type=docker,name=buildx-mdtest:store" \
    --set "*.output=type=image,name=example.com/buildx/mdtest:reg" \
    --set "*.output=type=oci,dest=./result"

$ cat md.json
{
  "default": {
    "buildx.build.ref": "...",
    "containerimage.digest": "sha256:d4802c4a6163e307eaf90dddc0d9d977cce8f1910b4bb675681e4d8a9466f4cf",
    "containerimage.descriptor": { ... },
    "image.name": "example.com/buildx/mdtest:reg"
  }
}

Both asserted keys are present, and image.name carries only the type=image name while the type=docker one is missing, which is why it is left out of the assertions.

testBakeMultiExporters checked the registry, docker store and OCI
outputs but left the metadata file untested, with a TODO from the time
multiple exporters were not supported.

They are now, and a bake with image, docker and OCI outputs writes a
metadata file with buildx.build.ref and containerimage.digest, so assert
both.

image.name is left alone: with several named exporters it still carries
one name, so it cannot stand in for the others yet. The TODO now says
that rather than pointing at multi exporter support in general.

Signed-off-by: SaiPisey2 <piseysai0202@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant