Files
podman/test/e2e/buildx_inspect_test.go
Joshua Arrevillaga 87450b8f8b podman buildx inspect support
Added support for "podman buildx inspect". The goal was to replicate the default output from "docker buildx inspect" as
much as possible but a problem encountered was podman not supporting BuildKit. To replicate the output I resorted to
printing the statements with default values but only changed the driver name to use podman instead of docker. Since
there was no buildkit, gave it the value of "N/A" to depict it's not supported. For Platforms, I resorted to using
the emulated architectures found on your linux system + the host architecture of your local machine or podman server. The
bootstrap flag was also added but is considered a NOP since there is no buildkit container to run before running inspect.
An extra field was added to the HostInfo struct so when you run "podman info" the emulated architectures will show, this
was used so you can grab the information from the podman engine.

Fixes #13014

Signed-off-by: Joshua Arrevillaga <2004jarrevillaga@gmail.com>
2025-06-03 11:07:08 -04:00

39 lines
1.2 KiB
Go

//go:build linux || freebsd
package integration
import (
"encoding/json"
"regexp"
"strings"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman buildx inspect", func() {
It("podman buildx inspect", func() {
session := podmanTest.PodmanExitCleanly("buildx", "inspect")
out := session.OutputToString()
session_bootstrap := podmanTest.PodmanExitCleanly("buildx", "inspect", "--bootstrap")
out_bootstrap := session_bootstrap.OutputToString()
Expect(out_bootstrap).To(Equal(out), "Output of 'podman buildx inspect' and 'podman buildx inspect --bootstrap' should be the same")
emuInfo := podmanTest.PodmanExitCleanly("info", "--format", "{{json .Host.EmulatedArchitectures}}")
var emuArchs []string
Expect(json.Unmarshal([]byte(emuInfo.OutputToString()), &emuArchs)).To(Succeed())
nativeInfo := podmanTest.PodmanExitCleanly("info", "--format", "{{.Host.OS}}/{{.Host.Arch}}")
nativePlat := strings.TrimSpace(nativeInfo.OutputToString())
Expect(nativePlat).ToNot(BeEmpty())
expected := append(emuArchs, nativePlat)
for _, p := range expected {
re := regexp.MustCompile(`(?s)Platforms:.*\b` + regexp.QuoteMeta(p) + `\b`)
Expect(out).To(MatchRegexp(re.String()), "missing %q in:\n%s", p, out)
}
})
})