mirror of
https://github.com/containers/podman.git
synced 2025-10-16 18:53:19 +08:00
Merge pull request #27159 from nothiaki/artifact-list-virtual-size
Added virtual size option in artifact ls format
This commit is contained in:
@ -40,6 +40,7 @@ type artifactListOutput struct {
|
|||||||
Repository string
|
Repository string
|
||||||
Size string
|
Size string
|
||||||
Tag string
|
Tag string
|
||||||
|
VirtualSize string
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -110,6 +111,7 @@ func outputTemplate(cmd *cobra.Command, lrs []*entities.ArtifactListReport) erro
|
|||||||
Repository: named.Name(),
|
Repository: named.Name(),
|
||||||
Size: units.HumanSize(float64(lr.Artifact.TotalSizeBytes())),
|
Size: units.HumanSize(float64(lr.Artifact.TotalSizeBytes())),
|
||||||
Tag: tag,
|
Tag: tag,
|
||||||
|
VirtualSize: fmt.Sprintf("%d", lr.Artifact.TotalSizeBytes()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ Print results with a Go template.
|
|||||||
| .Repository | Repository name of the artifact |
|
| .Repository | Repository name of the artifact |
|
||||||
| .Size | Size artifact in human readable units |
|
| .Size | Size artifact in human readable units |
|
||||||
| .Tag | Tag of the artifact name |
|
| .Tag | Tag of the artifact name |
|
||||||
|
| .VirtualSize | Size of artifact in bytes |
|
||||||
|
|
||||||
@@option no-trunc
|
@@option no-trunc
|
||||||
|
|
||||||
|
@ -66,6 +66,17 @@ var _ = Describe("Podman artifact", func() {
|
|||||||
noHeaderOutput := noHeaderSession.OutputToStringArray()
|
noHeaderOutput := noHeaderSession.OutputToStringArray()
|
||||||
Expect(noHeaderOutput).To(HaveLen(2))
|
Expect(noHeaderOutput).To(HaveLen(2))
|
||||||
Expect(noHeaderOutput).ToNot(ContainElement("REPOSITORY"))
|
Expect(noHeaderOutput).ToNot(ContainElement("REPOSITORY"))
|
||||||
|
|
||||||
|
// Check if .VirtualSize is reported correctly
|
||||||
|
virtualSizeFormatSession := podmanTest.PodmanExitCleanly("artifact", "ls", "--format", "{{.VirtualSize}}")
|
||||||
|
virtualSizes := virtualSizeFormatSession.OutputToStringArray()
|
||||||
|
|
||||||
|
// Should list 2 lines (without the header)
|
||||||
|
Expect(virtualSizes).To(HaveLen(2))
|
||||||
|
|
||||||
|
// Verify if the virtual size values are present in the output
|
||||||
|
Expect(virtualSizes).To(ContainElement("4192"))
|
||||||
|
Expect(virtualSizes).To(ContainElement("10240"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman artifact simple add", func() {
|
It("podman artifact simple add", func() {
|
||||||
|
Reference in New Issue
Block a user