fix up ghcr client tests and remove config from action package layers

This commit is contained in:
Conor Sloan
2024-08-23 10:56:04 +01:00
parent e53d6ca2a2
commit e308348d01
7 changed files with 482 additions and 547 deletions
File diff suppressed because it is too large Load Diff
+2 -5
View File
@@ -495,7 +495,7 @@ describe('run', () => {
expect(blobs.has('123')).toBeTruthy()
expect(blobs.has('1234')).toBeTruthy()
expect(manifest.mediaType).toBe(ociContainer.imageManifestMediaType)
expect(manifest.layers.length).toBe(3)
expect(manifest.layers.length).toBe(2)
expect(manifest.annotations['com.github.package.type']).toBe(
ociContainer.actionPackageAnnotationValue
)
@@ -585,7 +585,6 @@ describe('run', () => {
uploadOCIImageManifestMock.mockImplementation(
(token, registry, repository, manifest, blobs, tag) => {
let expectedBlobKeys: string[] = []
let expectedLayers = 0
let expectedAnnotationValue = ''
let expectedTagValue: string | undefined = undefined
let returnValue = ''
@@ -599,13 +598,11 @@ describe('run', () => {
)
expectedBlobKeys = [sigStoreLayer.digest, ociContainer.emptyConfigSha]
expectedLayers = 1
returnValue = 'sha256:attestation-digest'
} else {
expectedAnnotationValue = ociContainer.actionPackageAnnotationValue
expectedTagValue = '1.2.3'
expectedBlobKeys = ['123', '1234', ociContainer.emptyConfigSha]
expectedLayers = 3
returnValue = 'sha256:my-test-digest'
}
@@ -617,7 +614,7 @@ describe('run', () => {
expectedAnnotationValue
)
expect(tag).toBe(expectedTagValue)
expect(manifest.layers.length).toBe(expectedLayers)
expect(manifest.layers.length).toBe(expectedBlobKeys.length - 1) // Minus config layer
expect(blobs.size).toBe(expectedBlobKeys.length)
for (const expectedBlobKey of expectedBlobKeys) {
expect(blobs.has(expectedBlobKey)).toBeTruthy()
+2 -7
View File
@@ -16,7 +16,7 @@ describe('sha256Digest', () => {
const { manifest } = testActionPackageManifest()
const digest = sha256Digest(manifest)
const expectedDigest =
'sha256:dd8537ef913cf87e25064a074973ed2c62699f1dbd74d0dd78e85d394a5758b5'
'sha256:1af9bf993bf068a51fbb54822471ab7507b07c553bcac09a7c91328740d8ed69'
expect(digest).toEqual(expectedDigest)
})
@@ -26,7 +26,7 @@ describe('size', () => {
it('returns the total size of the provided manifest', () => {
const { manifest } = testActionPackageManifest()
const size = sizeInBytes(manifest)
expect(size).toBe(1133)
expect(size).toBe(991)
})
})
@@ -44,11 +44,6 @@ describe('createActionPackageManifest', () => {
"digest":"sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"
},
"layers":[
{
"mediaType":"application/vnd.oci.empty.v1+json",
"size":2,
"digest":"sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"
},
{
"mediaType":"application/vnd.github.actions.package.layer.v1.tar+gzip",
"size":${tarFile.size},