mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-04-22 16:06:36 +02:00
rename and align config inputs
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
b7cf918227
commit
f876da6242
6 changed files with 99 additions and 34 deletions
|
@ -1,12 +1,31 @@
|
|||
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as uuid from 'uuid';
|
||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
||||
import {Context} from '@docker/actions-toolkit/lib/context';
|
||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||
import {Node} from '@docker/actions-toolkit/lib/types/builder';
|
||||
|
||||
import * as context from '../src/context';
|
||||
|
||||
const fixturesDir = path.join(__dirname, 'fixtures');
|
||||
// prettier-ignore
|
||||
const tmpDir = path.join(process.env.TEMP || '/tmp', 'setup-buildx-jest');
|
||||
const tmpName = path.join(tmpDir, '.tmpname-jest');
|
||||
|
||||
jest.spyOn(Context, 'tmpDir').mockImplementation((): string => {
|
||||
if (!fs.existsSync(tmpDir)) {
|
||||
fs.mkdirSync(tmpDir, {recursive: true});
|
||||
}
|
||||
return tmpDir;
|
||||
});
|
||||
|
||||
jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
||||
return tmpName;
|
||||
});
|
||||
|
||||
jest.mock('uuid');
|
||||
jest.spyOn(uuid, 'v4').mockReturnValue('9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d');
|
||||
|
||||
|
@ -171,6 +190,42 @@ describe('getCreateArgs', () => {
|
|||
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
|
||||
'--driver', 'unknown',
|
||||
]
|
||||
],
|
||||
[
|
||||
8,
|
||||
'v0.10.3',
|
||||
new Map<string, string>([
|
||||
['install', 'false'],
|
||||
['use', 'false'],
|
||||
['buildkitd-config', path.join(fixturesDir, 'buildkitd.toml')],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true'],
|
||||
]),
|
||||
[
|
||||
'create',
|
||||
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
|
||||
'--driver', 'docker-container',
|
||||
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||
'--config', tmpName,
|
||||
]
|
||||
],
|
||||
[
|
||||
9,
|
||||
'v0.10.3',
|
||||
new Map<string, string>([
|
||||
['install', 'false'],
|
||||
['use', 'false'],
|
||||
['buildkitd-config-inline', 'debug = true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true'],
|
||||
]),
|
||||
[
|
||||
'create',
|
||||
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
|
||||
'--driver', 'docker-container',
|
||||
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||
'--config', tmpName,
|
||||
]
|
||||
]
|
||||
])(
|
||||
'[%d] given buildx %s and %p as inputs, returns %p',
|
||||
|
|
1
__tests__/fixtures/buildkitd.toml
Normal file
1
__tests__/fixtures/buildkitd.toml
Normal file
|
@ -0,0 +1 @@
|
|||
debug = true
|
Loading…
Add table
Add a link
Reference in a new issue