buildx: configDir

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-02-10 11:31:34 +01:00
parent 392903fad6
commit 5e365b5a48
2 changed files with 27 additions and 0 deletions

View File

@@ -46,6 +46,28 @@ afterEach(() => {
rimraf.sync(tmpDir);
});
describe('configDir', () => {
const originalEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {
...originalEnv,
BUILDX_CONFIG: '/var/docker/buildx',
DOCKER_CONFIG: '/var/docker/config'
};
});
afterEach(() => {
process.env = originalEnv;
});
it('returns default', async () => {
process.env.BUILDX_CONFIG = '';
expect(Buildx.configDir).toEqual(path.join('/var/docker/config', 'buildx'));
});
it('returns from env', async () => {
expect(Buildx.configDir).toEqual('/var/docker/buildx');
});
});
describe('isAvailable', () => {
it('docker cli', async () => {
const execSpy = jest.spyOn(exec, 'getExecOutput');