mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-04-22 16:06:36 +02:00
append nodes to builder support
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
95cb08cb26
commit
2dfca373f3
12 changed files with 249 additions and 14 deletions
|
@ -4,6 +4,7 @@ import * as os from 'os';
|
|||
import * as path from 'path';
|
||||
import * as uuid from 'uuid';
|
||||
import * as context from '../src/context';
|
||||
import * as nodes from '../src/nodes';
|
||||
|
||||
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-buildx-')).split(path.sep).join(path.posix.sep);
|
||||
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
||||
|
@ -103,6 +104,57 @@ describe('getCreateArgs', () => {
|
|||
);
|
||||
});
|
||||
|
||||
describe('getAppendArgs', () => {
|
||||
beforeEach(() => {
|
||||
process.env = Object.keys(process.env).reduce((object, key) => {
|
||||
if (!key.startsWith('INPUT_')) {
|
||||
object[key] = process.env[key];
|
||||
}
|
||||
return object;
|
||||
}, {});
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test.each([
|
||||
[
|
||||
0,
|
||||
new Map<string, string>([
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
]),
|
||||
{
|
||||
"name": "aws_graviton2",
|
||||
"endpoint": "ssh://me@graviton2",
|
||||
"driver-opts": [
|
||||
"image=moby/buildkit:latest"
|
||||
],
|
||||
"buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
|
||||
"platforms": "linux/arm64"
|
||||
},
|
||||
[
|
||||
'create',
|
||||
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
|
||||
'--append',
|
||||
'--node', 'aws_graviton2',
|
||||
'--driver-opt', 'image=moby/buildkit:latest',
|
||||
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||
'--platform', 'linux/arm64',
|
||||
'ssh://me@graviton2'
|
||||
]
|
||||
]
|
||||
])(
|
||||
'[%d] given %p as inputs, returns %p',
|
||||
async (num: number, inputs: Map<string, string>, node: nodes.Node, expected: Array<string>) => {
|
||||
inputs.forEach((value: string, name: string) => {
|
||||
setInput(name, value);
|
||||
});
|
||||
const inp = await context.getInputs();
|
||||
const res = await context.getAppendArgs(inp, node, '0.9.0');
|
||||
expect(res).toEqual(expected);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('getInputList', () => {
|
||||
it('handles single line correctly', async () => {
|
||||
await setInput('foo', 'bar');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue