MCPcopy
hub / github.com/cloudfoundry/cli / VerifyAppPackageContentsV2

Function VerifyAppPackageContentsV2

integration/helpers/package.go:61–80  ·  view source on GitHub ↗

VerifyAppPackageContentsV2 verifies the contents of a V2 app package by downloading the package zip and verifying the zipped files match the passed files.

(appName string, files ...string)

Source from the content-addressed store, hash-verified

59// VerifyAppPackageContentsV2 verifies the contents of a V2 app package by downloading the package zip and
60// verifying the zipped files match the passed files.
61func VerifyAppPackageContentsV2(appName string, files ...string) {
62 tmpZipFilepath, err := os.CreateTemp("", "")
63 defer os.Remove(tmpZipFilepath.Name())
64 Expect(err).ToNot(HaveOccurred())
65
66 downloadFirstAppBits(appName, tmpZipFilepath.Name())
67 Expect(err).ToNot(HaveOccurred())
68
69 info, err := tmpZipFilepath.Stat()
70 Expect(err).ToNot(HaveOccurred())
71 reader, err := ykk.NewReader(tmpZipFilepath, info.Size())
72 Expect(err).ToNot(HaveOccurred())
73
74 seenFiles := []string{}
75 for _, file := range reader.File {
76 seenFiles = append(seenFiles, file.Name)
77 }
78
79 Expect(seenFiles).To(ConsistOf(files))
80}
81
82func downloadFirstAppBits(appName string, tmpZipFilepath string) {
83 appGUID := AppGUID(appName)

Callers 1

Calls 3

downloadFirstAppBitsFunction · 0.85
NameMethod · 0.80
SizeMethod · 0.80

Tested by

no test coverage detected