mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-23 03:16:09 +08:00
buildx: printInspect
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
c857b8425c
commit
4259682b27
@ -1,6 +1,7 @@
|
||||
import {afterEach, beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import {Builder, BuilderInfo} from '../src/builder';
|
||||
import {Context} from '../src/context';
|
||||
|
||||
|
@ -151,6 +151,22 @@ describe('isAvailable', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('printInspect', () => {
|
||||
it('prints builder2 instance', () => {
|
||||
const execSpy = jest.spyOn(exec, 'exec');
|
||||
const buildx = new Buildx({
|
||||
context: new Context(),
|
||||
standalone: true
|
||||
});
|
||||
buildx.printInspect('builder2').catch(() => {
|
||||
// noop
|
||||
});
|
||||
expect(execSpy).toHaveBeenCalledWith(`buildx`, ['inspect', 'builder2'], {
|
||||
failOnStdErr: false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('printVersion', () => {
|
||||
it('docker cli', () => {
|
||||
const execSpy = jest.spyOn(exec, 'exec');
|
||||
|
@ -49,6 +49,13 @@ export class Buildx {
|
||||
});
|
||||
}
|
||||
|
||||
public async printInspect(name: string): Promise<void> {
|
||||
const cmd = this.getCommand(['inspect', name]);
|
||||
await exec.exec(cmd.command, cmd.args, {
|
||||
failOnStdErr: false
|
||||
});
|
||||
}
|
||||
|
||||
private async getVersion(): Promise<string> {
|
||||
const cmd = this.getCommand(['version']);
|
||||
return await exec
|
||||
|
Loading…
Reference in New Issue
Block a user