Merge pull request #676 from crazy-max/test-fix-timeout

test: set proper timeout when downloading binaries
This commit is contained in:
CrazyMax
2025-04-22 14:53:40 +02:00
committed by GitHub
4 changed files with 85 additions and 109 deletions

View File

@@ -37,19 +37,17 @@ describe('download', () => {
['latest', true]
])(
'acquires %p of buildx (standalone: %p)', async (version, standalone) => {
const install = new Install({standalone: standalone});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
let buildxBin: string;
if (standalone) {
buildxBin = await install.installStandalone(toolPath, tmpDir);
} else {
buildxBin = await install.installPlugin(toolPath, tmpDir);
}
expect(fs.existsSync(buildxBin)).toBe(true);
},
100000
);
const install = new Install({standalone: standalone});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
let buildxBin: string;
if (standalone) {
buildxBin = await install.installStandalone(toolPath, tmpDir);
} else {
buildxBin = await install.installPlugin(toolPath, tmpDir);
}
expect(fs.existsSync(buildxBin)).toBe(true);
}, 100000);
// prettier-ignore
test.each([
@@ -57,26 +55,22 @@ describe('download', () => {
['v0.9.0'],
['v0.10.5'],
])(
'acquires %p of buildx with cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
},
100000
);
'acquires %p of buildx with cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
}, 100000);
// prettier-ignore
test.each([
['v0.11.2'],
['v0.12.0'],
])(
'acquires %p of buildx without cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);
},
100000
);
'acquires %p of buildx without cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);
}, 100000);
// TODO: add tests for arm
// prettier-ignore
@@ -90,15 +84,13 @@ describe('download', () => {
['linux', 'ppc64'],
['linux', 's390x'],
])(
'acquires buildx for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const buildxBin = await install.download('latest');
expect(fs.existsSync(buildxBin)).toBe(true);
},
100000
);
'acquires buildx for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const buildxBin = await install.download('latest');
expect(fs.existsSync(buildxBin)).toBe(true);
}, 100000);
});
describe('build', () => {

View File

@@ -36,20 +36,18 @@ describe('download', () => {
['v2.32.4', true],
['latest', true]
])(
'acquires %p of compose (standalone: %p)', async (version, standalone) => {
const install = new Install({standalone: standalone});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
let composeBin: string;
if (standalone) {
composeBin = await install.installStandalone(toolPath, tmpDir);
} else {
composeBin = await install.installPlugin(toolPath, tmpDir);
}
expect(fs.existsSync(composeBin)).toBe(true);
},
100000
);
'acquires %p of compose (standalone: %p)', async (version, standalone) => {
const install = new Install({standalone: standalone});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
let composeBin: string;
if (standalone) {
composeBin = await install.installStandalone(toolPath, tmpDir);
} else {
composeBin = await install.installPlugin(toolPath, tmpDir);
}
expect(fs.existsSync(composeBin)).toBe(true);
}, 100000);
// prettier-ignore
test.each([
@@ -57,26 +55,22 @@ describe('download', () => {
['v2.31.0'],
['v2.32.4'],
])(
'acquires %p of compose with cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
},
100000
);
'acquires %p of compose with cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
}, 100000);
// prettier-ignore
test.each([
['v2.27.1'],
['v2.28.0'],
])(
'acquires %p of compose without cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);
},
100000
);
'acquires %p of compose without cache', async (version) => {
const install = new Install({standalone: false});
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);
}, 100000);
// TODO: add tests for arm
// prettier-ignore
@@ -90,15 +84,13 @@ describe('download', () => {
['linux', 'ppc64'],
['linux', 's390x'],
])(
'acquires compose for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const composeBin = await install.download('latest');
expect(fs.existsSync(composeBin)).toBe(true);
},
100000
);
'acquires compose for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const composeBin = await install.download('latest');
expect(fs.existsSync(composeBin)).toBe(true);
}, 100000);
});
describe('getDownloadVersion', () => {

View File

@@ -36,14 +36,12 @@ describe('download', () => {
['latest']
])(
'acquires %p of regclient', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
const regclientBin = await install.install(toolPath, tmpDir);
expect(fs.existsSync(regclientBin)).toBe(true);
},
100000
);
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
const regclientBin = await install.install(toolPath, tmpDir);
expect(fs.existsSync(regclientBin)).toBe(true);
}, 100000);
// prettier-ignore
test.each([
@@ -54,7 +52,7 @@ describe('download', () => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
});
}, 100000);
// prettier-ignore
test.each([
@@ -64,7 +62,7 @@ describe('download', () => {
const install = new Install();
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);
});
}, 100000);
// prettier-ignore
test.each([
@@ -77,14 +75,12 @@ describe('download', () => {
['linux', 's390x'],
])(
'acquires regclient for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const regclientBin = await install.download('latest');
expect(fs.existsSync(regclientBin)).toBe(true);
},
100000
);
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const regclientBin = await install.download('latest');
expect(fs.existsSync(regclientBin)).toBe(true);
}, 100000);
});
describe('getDownloadVersion', () => {

View File

@@ -37,14 +37,12 @@ describe('download', () => {
['latest']
])(
'acquires %p of undock', async (version) => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
const undockBin = await install.install(toolPath, tmpDir);
expect(fs.existsSync(undockBin)).toBe(true);
},
100000
);
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
const undockBin = await install.install(toolPath, tmpDir);
expect(fs.existsSync(undockBin)).toBe(true);
}, 100000);
// prettier-ignore
test.each([
@@ -56,7 +54,7 @@ describe('download', () => {
const install = new Install();
const toolPath = await install.download(version);
expect(fs.existsSync(toolPath)).toBe(true);
});
}, 100000);
// prettier-ignore
test.each([
@@ -67,7 +65,7 @@ describe('download', () => {
const install = new Install();
const toolPath = await install.download(version, true);
expect(fs.existsSync(toolPath)).toBe(true);
});
}, 100000);
// TODO: add tests for arm
// prettier-ignore
@@ -82,14 +80,12 @@ describe('download', () => {
['linux', 's390x'],
])(
'acquires undock for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const undockBin = await install.download('latest');
expect(fs.existsSync(undockBin)).toBe(true);
},
100000
);
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
const install = new Install();
const undockBin = await install.download('latest');
expect(fs.existsSync(undockBin)).toBe(true);
}, 100000);
});
describe('getDownloadVersion', () => {