test: fix name output
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -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`);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user