Merge pull request #998 from crazy-max/test-output

test: fix name output
This commit is contained in:
CrazyMax
2026-03-01 14:28:17 +01:00
committed by GitHub
22 changed files with 60 additions and 60 deletions

View File

@@ -54,7 +54,7 @@ describe('satisfies', () => {
test.each([
['builder2', '>=0.10.0', true],
['builder2', '>0.11.0', false]
])('given %p', async (builderName, range, expected) => {
])('given %o', async (builderName, range, expected) => {
const buildkit = new BuildKit();
expect(await buildkit.versionSatisfies(builderName, range)).toBe(expected);
});

View File

@@ -53,7 +53,7 @@ describe('resolve', () => {
`,
null
]
])('given %p config', async (val: string, file: boolean, exValue: string, error: Error | null) => {
])('given %o config', async (val: string, file: boolean, exValue: string, error: Error | null) => {
try {
const buildkit = new BuildKit();
let config: string;

View File

@@ -181,7 +181,7 @@ describe('parseURL', () => {
} as GitURL,
false
],
])('given %p', async (ref: string, expected: GitURL, expectedErr: boolean) => {
])('given %o', async (ref: string, expected: GitURL, expectedErr: boolean) => {
try {
const got = Git.parseURL(ref);
expect(got.scheme).toEqual(expected.scheme);
@@ -329,7 +329,7 @@ describe('parseRef', () => {
'.git',
undefined
],
])('given %p', async (ref: string, expected: GitRef | undefined) => {
])('given %o', async (ref: string, expected: GitRef | undefined) => {
try {
const got = Git.parseRef(ref);
expect(got).toEqual(expected);

View File

@@ -41,7 +41,7 @@ maybe('getDefinition', () => {
// path.join(fixturesDir, 'bake-test-docker-action-remote-private.json'),
// true,
// ]
])('given %p', async (source: string, targets: string[], out: string, auth) => {
])('given %o', async (source: string, targets: string[], out: string, auth) => {
const gitAuthToken = process.env.GITHUB_TOKEN || '';
if (auth && !gitAuthToken) {
console.log(`Git auth token not available, skipping test`);

View File

@@ -102,7 +102,7 @@ describe('getDefinition', () => {
undefined,
path.join(fixturesDir, 'bake-03-default.json')
],
])('given %p', async (files: string[], targets: string[], overrides: string[], execOptions: ExecOptions | undefined, out: string) => {
])('given %o', async (files: string[], targets: string[], overrides: string[], execOptions: ExecOptions | undefined, out: string) => {
const bake = new Bake();
const expectedDef = <BakeDefinition>JSON.parse(fs.readFileSync(out, {encoding: 'utf-8'}).trim())
expect(await bake.getDefinition({
@@ -185,7 +185,7 @@ describe('hasLocalExporter', () => {
} as unknown as BakeDefinition,
true
]
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
])('given %o returns %o', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasLocalExporter(def)).toEqual(expected);
});
});
@@ -285,7 +285,7 @@ describe('hasTarExporter', () => {
} as unknown as BakeDefinition,
false
],
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
])('given %o returns %o', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasTarExporter(def)).toEqual(expected);
});
});
@@ -440,7 +440,7 @@ describe('hasDockerExporter', () => {
true,
true
],
])('given %o and load:%p returns %p', async (def: BakeDefinition, expected: boolean, load: boolean | undefined) => {
])('given %o and load: %o returns %o', async (def: BakeDefinition, expected: boolean, load: boolean | undefined) => {
expect(Bake.hasDockerExporter(def, load)).toEqual(expected);
});
});
@@ -481,7 +481,7 @@ describe('hasGitAuthTokenSecret', () => {
} as unknown as BakeDefinition,
true
],
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
])('given %o returns %o', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasGitAuthTokenSecret(def)).toEqual(expected);
});
});
@@ -536,7 +536,7 @@ describe('hasProvenanceAttestation', () => {
} as unknown as BakeDefinition,
true
]
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
])('given %o returns %o', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasProvenanceAttestation(def)).toEqual(expected);
});
});
@@ -591,7 +591,7 @@ describe('hasSBOMAttestation', () => {
} as unknown as BakeDefinition,
true
]
])('given %o returns %p', async (def: BakeDefinition, expected: boolean) => {
])('given %o returns %o', async (def: BakeDefinition, expected: boolean) => {
expect(Bake.hasSBOMAttestation(def)).toEqual(expected);
});
});

View File

@@ -136,7 +136,7 @@ describe('getProvenanceInput', () => {
'',
''
],
])('given input %p', async (input: string, expected: string) => {
])('given input %o', async (input: string, expected: string) => {
setInput('provenance', input);
expect(Build.getProvenanceInput('provenance')).toEqual(expected);
});
@@ -165,7 +165,7 @@ describe('resolveProvenanceAttrs', () => {
'',
'builder-id=https://github.com/docker/actions-toolkit/actions/runs/2188748038/attempts/2'
],
])('given %p', async (input: string, expected: string) => {
])('given %o', async (input: string, expected: string) => {
expect(Build.resolveProvenanceAttrs(input)).toEqual(expected);
});
});
@@ -180,7 +180,7 @@ describe('resolveSecret', () => {
['=bbbbbbb', false, '', '', new Error('=bbbbbbb is not a valid secret')],
[`foo=${path.join(fixturesDir, 'secret.txt')}`, true, 'foo', 'bar', null],
[`notfound=secret`, true, '', '', new Error('secret file secret not found')]
])('given %p key and %p secret', async (kvp: string, file: boolean, exKey: string, exValue: string, error: Error | null) => {
])('given %o key and %o secret', async (kvp: string, file: boolean, exKey: string, exValue: string, error: Error | null) => {
try {
let secret: string;
if (file) {
@@ -201,7 +201,7 @@ describe('resolveSecret', () => {
['FOO=', 'FOO', '', new Error('FOO= is not a valid secret')],
['=bar', '', '', new Error('=bar is not a valid secret')],
['FOO=bar=baz', 'FOO', 'bar=baz', null]
])('given %p key and %p env', async (kvp: string, exKey: string, exValue: string, error: Error | null) => {
])('given %o key and %o env', async (kvp: string, exKey: string, exValue: string, error: Error | null) => {
try {
const secret = Build.resolveSecretEnv(kvp);
expect(secret).toEqual(`id=${exKey},env=${exValue}`);
@@ -255,7 +255,7 @@ describe('resolveCacheToAttrs', () => {
'abcd1234',
'type=gha,repository=foo/bar,mode=max,ghtoken=abcd1234',
],
])('given %p', async (input: string, githubToken: string | undefined, expected: string) => {
])('given %o', async (input: string, githubToken: string | undefined, expected: string) => {
expect(Build.resolveCacheToAttrs(input, githubToken)).toEqual(expected);
});
});
@@ -271,7 +271,7 @@ describe('hasLocalExporter', () => {
[['"type=tar","dest=/tmp/image.tar"'], false],
[['" type= local" , dest=./release-out'], true],
[['.'], true]
])('given %p returns %p', async (exporters: Array<string>, expected: boolean) => {
])('given %o returns %o', async (exporters: Array<string>, expected: boolean) => {
expect(Build.hasLocalExporter(exporters)).toEqual(expected);
});
});
@@ -287,7 +287,7 @@ describe('hasTarExporter', () => {
[['"type=tar","dest=/tmp/image.tar"'], true],
[['" type= local" , dest=./release-out'], false],
[['.'], false]
])('given %p returns %p', async (exporters: Array<string>, expected: boolean) => {
])('given %o returns %o', async (exporters: Array<string>, expected: boolean) => {
expect(Build.hasTarExporter(exporters)).toEqual(expected);
});
});
@@ -305,7 +305,7 @@ describe('hasDockerExporter', () => {
[['type=docker'], true, false],
[['type=docker'], true, true],
[['.'], true, true],
])('given %p returns %p', async (exporters: Array<string>, expected: boolean, load: boolean | undefined) => {
])('given %o returns %o', async (exporters: Array<string>, expected: boolean, load: boolean | undefined) => {
expect(Build.hasDockerExporter(exporters, load)).toEqual(expected);
});
});
@@ -316,7 +316,7 @@ describe('hasAttestationType', () => {
['type=provenance,mode=min', 'provenance', true],
['type=sbom,true', 'sbom', true],
['type=foo,bar', 'provenance', false],
])('given %p for %p returns %p', async (attrs: string, name: string, expected: boolean) => {
])('given %o for %o returns %o', async (attrs: string, name: string, expected: boolean) => {
expect(Build.hasAttestationType(name, attrs)).toEqual(expected);
});
});
@@ -340,7 +340,7 @@ describe('resolveAttestationAttrs', () => {
'',
''
],
])('given %p', async (input: string, expected: string) => {
])('given %o', async (input: string, expected: string) => {
expect(Build.resolveAttestationAttrs(input)).toEqual(expected);
});
});
@@ -351,7 +351,7 @@ describe('hasGitAuthTokenSecret', () => {
[['A_SECRET=abcdef0123456789'], undefined, false],
[['GIT_AUTH_TOKEN=abcdefghijklmno=0123456789'], undefined, true],
[['GIT_AUTH_TOKEN.github.com=abcdefghijklmno=0123456789'], 'github.com', true],
])('given %p secret', async (kvp: Array<string>, domain: string | undefined, expected: boolean) => {
])('given %o secret', async (kvp: Array<string>, domain: string | undefined, expected: boolean) => {
expect(Build.hasGitAuthTokenSecret(kvp, domain)).toBe(expected);
});
});

View File

@@ -548,7 +548,7 @@ baz = qux
]
}
],
])('given %p', async (inspectFile, expected) => {
])('given %o', async (inspectFile, expected) => {
expect(await Builder.parseInspect(fs.readFileSync(path.join(fixturesDir, inspectFile)).toString())).toEqual(expected);
});
});

View File

@@ -145,7 +145,7 @@ describe('parseVersion', () => {
['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'],
['github.com/docker/buildx f117971 f11797113e5a9b86bd976329c5dbb8a8bfdfadfa', 'f117971']
])('given %p', async (stdout, expected) => {
])('given %o', async (stdout, expected) => {
expect(Buildx.parseVersion(stdout)).toEqual(expected);
});
});
@@ -155,7 +155,7 @@ describe('versionSatisfies', () => {
['0.4.1', '>=0.3.2', true],
['bda4882a65349ca359216b135896bddc1d92461c', '>0.1.0', false],
['f117971', '>0.6.0', true]
])('given %p', async (version, range, expected) => {
])('given %o', async (version, range, expected) => {
const buildx = new Buildx();
expect(await buildx.versionSatisfies(range, version)).toBe(expected);
});
@@ -236,7 +236,7 @@ describe('resolveCertsDriverOpts', () => {
],
[]
],
])('%p. given %p endpoint, %p driver', async (id: number, endpoint: string, driver: string, cert: Cert, expectedFiles: Array<string>, expectedOpts: Array<string>) => {
])('%o. given %o endpoint, %o driver', async (id: number, endpoint: string, driver: string, cert: Cert, expectedFiles: Array<string>, expectedOpts: Array<string>) => {
fs.mkdirSync(Buildx.certsDir, {recursive: true});
expect(Buildx.resolveCertsDriverOpts(driver, endpoint, cert)).toEqual(expectedOpts);
for (const k in expectedFiles) {
@@ -298,7 +298,7 @@ describe('localState', () => {
DockerfilePath: '-'
} as LocalState,
]
])('given %p', async (ref: string, expected: LocalState) => {
])('given %o', async (ref: string, expected: LocalState) => {
const localState = Buildx.localState(ref, path.join(fixturesDir, 'buildx-refs'));
expect(localState).toEqual(expected);
});

View File

@@ -37,7 +37,7 @@ describe('download', () => {
['v0.10.5', true],
['latest', true]
])(
'acquires %p of buildx (standalone: %p)', async (version, standalone) => {
'acquires %o of buildx (standalone: %o)', async (version, standalone) => {
const install = new Install({standalone: standalone});
const toolPath = await install.download({version});
expect(fs.existsSync(toolPath)).toBe(true);
@@ -56,7 +56,7 @@ describe('download', () => {
['v0.9.0'],
['v0.10.5'],
])(
'acquires %p of buildx with cache', async (version) => {
'acquires %o of buildx with cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download({version});
expect(fs.existsSync(toolPath)).toBe(true);
@@ -67,7 +67,7 @@ describe('download', () => {
['v0.11.2'],
['v0.12.0'],
])(
'acquires %p of buildx without cache', async (version) => {
'acquires %o of buildx without cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download({version: version, ghaNoCache: true});
expect(fs.existsSync(toolPath)).toBe(true);

View File

@@ -101,7 +101,7 @@ describe('parseVersion', () => {
// prettier-ignore
test.each([
['Docker Compose version v2.31.0', '2.31.0'],
])('given %p', async (stdout, expected) => {
])('given %o', async (stdout, expected) => {
expect(Compose.parseVersion(stdout)).toEqual(expected);
});
});

View File

@@ -37,7 +37,7 @@ describe('download', () => {
['v2.32.4', true],
['latest', true]
])(
'acquires %p of compose (standalone: %p)', async (version, standalone) => {
'acquires %o of compose (standalone: %o)', async (version, standalone) => {
const install = new Install({standalone: standalone});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
@@ -56,7 +56,7 @@ describe('download', () => {
['v2.31.0'],
['v2.32.4'],
])(
'acquires %p of compose with cache', async (version) => {
'acquires %o of compose with cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
@@ -67,7 +67,7 @@ describe('download', () => {
['v2.27.1'],
['v2.28.0'],
])(
'acquires %p of compose without cache', async (version) => {
'acquires %o of compose without cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);

View File

@@ -66,7 +66,7 @@ describe('parseGitRef', () => {
['refs/tags/v1.0.0', '', false, 'refs/tags/v1.0.0'],
['refs/pull/15/merge', '', false, 'refs/pull/15/merge'],
['refs/pull/15/merge', '', true, 'refs/pull/15/head'],
])('given %p and %p, should return %p', async (ref: string, sha: string, prHeadRef: boolean, expected: string) => {
])('given %o and %o, should return %o', async (ref: string, sha: string, prHeadRef: boolean, expected: string) => {
process.env.DOCKER_DEFAULT_GIT_CONTEXT_PR_HEAD_REF = prHeadRef ? 'true' : '';
expect(Context.parseGitRef(ref, sha)).toEqual(expected);
});

View File

@@ -59,7 +59,7 @@ describe('versionSatisfies', () => {
['v0.4.1', '>=0.3.2', true],
['v0.8.0', '>0.6.0', true],
['v0.8.0', '<0.3.0', false]
])('given %p', async (version, range, expected) => {
])('given %o', async (version, range, expected) => {
const cosign = new Cosign();
expect(await cosign.versionSatisfies(range, version)).toBe(expected);
});
@@ -71,7 +71,7 @@ describe('parseCommandOutput', () => {
[path.join(fixturesDir, 'cosign', 'sign-output1.txt')],
[path.join(fixturesDir, 'cosign', 'sign-output2.txt')],
[path.join(fixturesDir, 'cosign', 'sign-output3.txt')],
])('parsing %p', async (fixturePath: string) => {
])('parsing %o', async (fixturePath: string) => {
const signResult = Cosign.parseCommandOutput(fs.readFileSync(fixturePath, 'utf-8'));
expect(signResult).toBeDefined();
expect(signResult.bundle).toBeDefined();
@@ -80,7 +80,7 @@ describe('parseCommandOutput', () => {
// prettier-ignore
test.each([
[path.join(fixturesDir, 'cosign', 'verify-output-err1.txt')],
])('parsing %p', async (fixturePath: string) => {
])('parsing %o', async (fixturePath: string) => {
const signResult = Cosign.parseCommandOutput(fs.readFileSync(fixturePath, 'utf-8'));
expect(signResult).toBeDefined();
expect(signResult.bundle).toBeUndefined();

View File

@@ -37,7 +37,7 @@ describe('download', () => {
['v3.0.1'],
['latest']
])(
'acquires %p of cosign', async (version) => {
'acquires %o of cosign', async (version) => {
const install = new Install();
const toolPath = await install.download({version});
expect(fs.existsSync(toolPath)).toBe(true);
@@ -51,7 +51,7 @@ describe('download', () => {
['v2.6.1'],
['v3.0.1'],
])(
'acquires %p of cosign with cache', async (version) => {
'acquires %o of cosign with cache', async (version) => {
const install = new Install();
const toolPath = await install.download({version});
expect(fs.existsSync(toolPath)).toBe(true);
@@ -62,7 +62,7 @@ describe('download', () => {
['v2.5.3'],
['v2.6.0'],
])(
'acquires %p of cosign without cache', async (version) => {
'acquires %o of cosign without cache', async (version) => {
const install = new Install();
const toolPath = await install.download({
version: version,

View File

@@ -60,7 +60,7 @@ describe('download', () => {
[image('27.3.1'), 'linux'],
[image('27.3.1'), 'win32'],
])(
'acquires %p of docker (%s)', async (source, platformOS) => {
'acquires %o of docker (%s)', async (source, platformOS) => {
mockPlatform(platformOS as NodeJS.Platform);
mockArch('x64');
const install = new Install({

View File

@@ -63,7 +63,7 @@ describe('releases', () => {
['.github/docker-releases.json'],
['.github/regclient-releases.json'],
['.github/undock-releases.json'],
])('returns %p', async (path: string) => {
])('returns %o', async (path: string) => {
const github = new GitHub();
const releases = await github.releases('App', {
owner: 'docker',

View File

@@ -56,7 +56,7 @@ describe('loadArchive', () => {
// prettier-ignore
test.each(fs.readdirSync(path.join(fixturesDir, 'oci-archive')).filter(file => {
return fs.statSync(path.join(path.join(fixturesDir, 'oci-archive'), file)).isFile();
}).map(filename => [filename]))('extracting %p', async (filename) => {
}).map(filename => [filename]))('extracting %o', async (filename) => {
const res = await OCI.loadArchive({
file: path.join(fixturesDir, 'oci-archive', filename)
});

View File

@@ -36,7 +36,7 @@ describe('download', () => {
['v0.8.2'],
['latest']
])(
'acquires %p of regclient', async (version) => {
'acquires %o of regclient', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
@@ -49,7 +49,7 @@ describe('download', () => {
// following versions are already cached to htc from previous test cases
['v0.8.2'],
])(
'acquires %p of regclient with cache', async (version) => {
'acquires %o of regclient with cache', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
@@ -59,7 +59,7 @@ describe('download', () => {
test.each([
['v0.8.1'],
])(
'acquires %p of regclient without cache', async (version) => {
'acquires %o of regclient without cache', async (version) => {
const install = new Install();
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);

View File

@@ -27,7 +27,7 @@ describe('manifestGet', () => {
test.each([
['moby/moby-bin:28.1.0-rc.2'],
['crazymax/diun:4.17.0'],
])('given %p', async image => {
])('given %o', async image => {
const regctl = new Regctl();
const manifest = await regctl.manifestGet({
image: image,
@@ -45,7 +45,7 @@ describe('blobGet', () => {
test.each([
['moby/moby-bin', 'sha256:234fccbd13fde0ba978a19f728cbdc67e29bc76247ac560822bb6ae5236c0bf0'],
['crazymax/diun', 'sha256:1e4881f66e0ec0f1710b837002107050bbbc0a231d8a42d7f422b56a139900bb'],
])('given %p', async (repo, digest) => {
])('given %o', async (repo, digest) => {
const regctl = new Regctl();
const blob = await regctl.blobGet({
repository: repo,
@@ -60,7 +60,7 @@ describe('image config', () => {
test.each([
['moby/moby-bin:28.1.0-rc.2'],
['crazymax/diun:4.17.0'],
])('given %p', async image => {
])('given %o', async image => {
const regctl = new Regctl();
const manifest = await regctl.manifestGet({
image: image,
@@ -115,7 +115,7 @@ describe('versionSatisfies', () => {
['v0.8.2', '>=0.6.0', true],
['v0.8.0', '>0.6.0', true],
['v0.8.0', '<0.3.0', false]
])('given %p', async (version, range, expected) => {
])('given %o', async (version, range, expected) => {
const regctl = new Regctl();
expect(await regctl.versionSatisfies(range, version)).toBe(expected);
});

View File

@@ -37,7 +37,7 @@ describe('download', () => {
['v0.7.0'],
['latest']
])(
'acquires %p of undock', async (version) => {
'acquires %o of undock', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
@@ -51,7 +51,7 @@ describe('download', () => {
['v0.4.0'],
['v0.7.0'],
])(
'acquires %p of undock with cache', async (version) => {
'acquires %o of undock with cache', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
@@ -62,7 +62,7 @@ describe('download', () => {
['v0.5.0'],
['v0.6.0'],
])(
'acquires %p of undock without cache', async (version) => {
'acquires %o of undock without cache', async (version) => {
const install = new Install();
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);

View File

@@ -76,7 +76,7 @@ describe('versionSatisfies', () => {
['v0.4.1', '>=0.3.2', true],
['v0.8.0', '>0.6.0', true],
['v0.8.0', '<0.3.0', false]
])('given %p', async (version, range, expected) => {
])('given %o', async (version, range, expected) => {
const undock = new Undock();
expect(await undock.versionSatisfies(range, version)).toBe(expected);
});

View File

@@ -247,7 +247,7 @@ describe('isValidURL', () => {
['git://github.com/user/repo.git', false],
['github.com/moby/buildkit.git#main', false],
['v0.4.1', false]
])('given %p', async (url, expected) => {
])('given %o', async (url, expected) => {
expect(Util.isValidURL(url)).toEqual(expected);
});
});
@@ -260,7 +260,7 @@ describe('isValidRef', () => {
['git://github.com/user/repo.git', true],
['github.com/moby/buildkit.git#main', true],
['v0.4.1', false]
])('given %p', async (url, expected) => {
])('given %o', async (url, expected) => {
expect(Util.isValidRef(url)).toEqual(expected);
});
});
@@ -278,7 +278,7 @@ describe('trimPrefix', () => {
['abcdabc', 'abc', 'dabc'],
['abcabc', 'abc', 'abc'],
['abcdabc', 'd', 'abcdabc']
])('given %p', async (str, prefix, expected) => {
])('given %o', async (str, prefix, expected) => {
expect(Util.trimPrefix(str, prefix)).toEqual(expected);
});
});
@@ -295,7 +295,7 @@ describe('trimSuffix', () => {
['abcdabc', 'abc', 'abcd'],
['abcabc', 'abc', 'abc'],
['abcdabc', 'd', 'abcdabc']
])('given %p', async (str, suffix, expected) => {
])('given %o', async (str, suffix, expected) => {
expect(Util.trimSuffix(str, suffix)).toEqual(expected);
});
});