Skip to content

Commit b6da7a2

Browse files
authored
Merge pull request #676 from crazy-max/test-fix-timeout
test: set proper timeout when downloading binaries
2 parents bb3b1ba + 7b40154 commit b6da7a2

File tree

4 files changed

+85
-109
lines changed

4 files changed

+85
-109
lines changed

__tests__/buildx/install.test.ts

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,46 +37,40 @@ describe('download', () => {
3737
['latest', true]
3838
])(
3939
'acquires %p of buildx (standalone: %p)', async (version, standalone) => {
40-
const install = new Install({standalone: standalone});
41-
const toolPath = await install.download(version);
42-
expect(fs.existsSync(toolPath)).toBe(true);
43-
let buildxBin: string;
44-
if (standalone) {
45-
buildxBin = await install.installStandalone(toolPath, tmpDir);
46-
} else {
47-
buildxBin = await install.installPlugin(toolPath, tmpDir);
48-
}
49-
expect(fs.existsSync(buildxBin)).toBe(true);
50-
},
51-
100000
52-
);
40+
const install = new Install({standalone: standalone});
41+
const toolPath = await install.download(version);
42+
expect(fs.existsSync(toolPath)).toBe(true);
43+
let buildxBin: string;
44+
if (standalone) {
45+
buildxBin = await install.installStandalone(toolPath, tmpDir);
46+
} else {
47+
buildxBin = await install.installPlugin(toolPath, tmpDir);
48+
}
49+
expect(fs.existsSync(buildxBin)).toBe(true);
50+
}, 100000);
5351

5452
// prettier-ignore
5553
test.each([
5654
// following versions are already cached to htc from previous test cases
5755
['v0.9.0'],
5856
['v0.10.5'],
5957
])(
60-
'acquires %p of buildx with cache', async (version) => {
61-
const install = new Install({standalone: false});
62-
const toolPath = await install.download(version);
63-
expect(fs.existsSync(toolPath)).toBe(true);
64-
},
65-
100000
66-
);
58+
'acquires %p of buildx with cache', async (version) => {
59+
const install = new Install({standalone: false});
60+
const toolPath = await install.download(version);
61+
expect(fs.existsSync(toolPath)).toBe(true);
62+
}, 100000);
6763

6864
// prettier-ignore
6965
test.each([
7066
['v0.11.2'],
7167
['v0.12.0'],
7268
])(
73-
'acquires %p of buildx without cache', async (version) => {
74-
const install = new Install({standalone: false});
75-
const toolPath = await install.download(version, true);
76-
expect(fs.existsSync(toolPath)).toBe(true);
77-
},
78-
100000
79-
);
69+
'acquires %p of buildx without cache', async (version) => {
70+
const install = new Install({standalone: false});
71+
const toolPath = await install.download(version, true);
72+
expect(fs.existsSync(toolPath)).toBe(true);
73+
}, 100000);
8074

8175
// TODO: add tests for arm
8276
// prettier-ignore
@@ -90,15 +84,13 @@ describe('download', () => {
9084
['linux', 'ppc64'],
9185
['linux', 's390x'],
9286
])(
93-
'acquires buildx for %s/%s', async (os, arch) => {
94-
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
95-
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
96-
const install = new Install();
97-
const buildxBin = await install.download('latest');
98-
expect(fs.existsSync(buildxBin)).toBe(true);
99-
},
100-
100000
101-
);
87+
'acquires buildx for %s/%s', async (os, arch) => {
88+
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
89+
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
90+
const install = new Install();
91+
const buildxBin = await install.download('latest');
92+
expect(fs.existsSync(buildxBin)).toBe(true);
93+
}, 100000);
10294
});
10395

10496
describe('build', () => {

__tests__/compose/install.test.ts

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -36,47 +36,41 @@ describe('download', () => {
3636
['v2.32.4', true],
3737
['latest', true]
3838
])(
39-
'acquires %p of compose (standalone: %p)', async (version, standalone) => {
40-
const install = new Install({standalone: standalone});
41-
const toolPath = await install.download(version);
42-
expect(fs.existsSync(toolPath)).toBe(true);
43-
let composeBin: string;
44-
if (standalone) {
45-
composeBin = await install.installStandalone(toolPath, tmpDir);
46-
} else {
47-
composeBin = await install.installPlugin(toolPath, tmpDir);
48-
}
49-
expect(fs.existsSync(composeBin)).toBe(true);
50-
},
51-
100000
52-
);
39+
'acquires %p of compose (standalone: %p)', async (version, standalone) => {
40+
const install = new Install({standalone: standalone});
41+
const toolPath = await install.download(version);
42+
expect(fs.existsSync(toolPath)).toBe(true);
43+
let composeBin: string;
44+
if (standalone) {
45+
composeBin = await install.installStandalone(toolPath, tmpDir);
46+
} else {
47+
composeBin = await install.installPlugin(toolPath, tmpDir);
48+
}
49+
expect(fs.existsSync(composeBin)).toBe(true);
50+
}, 100000);
5351

5452
// prettier-ignore
5553
test.each([
5654
// following versions are already cached to htc from previous test cases
5755
['v2.31.0'],
5856
['v2.32.4'],
5957
])(
60-
'acquires %p of compose with cache', async (version) => {
61-
const install = new Install({standalone: false});
62-
const toolPath = await install.download(version);
63-
expect(fs.existsSync(toolPath)).toBe(true);
64-
},
65-
100000
66-
);
58+
'acquires %p of compose with cache', async (version) => {
59+
const install = new Install({standalone: false});
60+
const toolPath = await install.download(version);
61+
expect(fs.existsSync(toolPath)).toBe(true);
62+
}, 100000);
6763

6864
// prettier-ignore
6965
test.each([
7066
['v2.27.1'],
7167
['v2.28.0'],
7268
])(
73-
'acquires %p of compose without cache', async (version) => {
74-
const install = new Install({standalone: false});
75-
const toolPath = await install.download(version, true);
76-
expect(fs.existsSync(toolPath)).toBe(true);
77-
},
78-
100000
79-
);
69+
'acquires %p of compose without cache', async (version) => {
70+
const install = new Install({standalone: false});
71+
const toolPath = await install.download(version, true);
72+
expect(fs.existsSync(toolPath)).toBe(true);
73+
}, 100000);
8074

8175
// TODO: add tests for arm
8276
// prettier-ignore
@@ -90,15 +84,13 @@ describe('download', () => {
9084
['linux', 'ppc64'],
9185
['linux', 's390x'],
9286
])(
93-
'acquires compose for %s/%s', async (os, arch) => {
94-
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
95-
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
96-
const install = new Install();
97-
const composeBin = await install.download('latest');
98-
expect(fs.existsSync(composeBin)).toBe(true);
99-
},
100-
100000
101-
);
87+
'acquires compose for %s/%s', async (os, arch) => {
88+
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
89+
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
90+
const install = new Install();
91+
const composeBin = await install.download('latest');
92+
expect(fs.existsSync(composeBin)).toBe(true);
93+
}, 100000);
10294
});
10395

10496
describe('getDownloadVersion', () => {

__tests__/regclient/install.test.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ describe('download', () => {
3636
['latest']
3737
])(
3838
'acquires %p of regclient', async (version) => {
39-
const install = new Install();
40-
const toolPath = await install.download(version);
41-
expect(fs.existsSync(toolPath)).toBe(true);
42-
const regclientBin = await install.install(toolPath, tmpDir);
43-
expect(fs.existsSync(regclientBin)).toBe(true);
44-
},
45-
100000
46-
);
39+
const install = new Install();
40+
const toolPath = await install.download(version);
41+
expect(fs.existsSync(toolPath)).toBe(true);
42+
const regclientBin = await install.install(toolPath, tmpDir);
43+
expect(fs.existsSync(regclientBin)).toBe(true);
44+
}, 100000);
4745

4846
// prettier-ignore
4947
test.each([
@@ -54,7 +52,7 @@ describe('download', () => {
5452
const install = new Install();
5553
const toolPath = await install.download(version);
5654
expect(fs.existsSync(toolPath)).toBe(true);
57-
});
55+
}, 100000);
5856

5957
// prettier-ignore
6058
test.each([
@@ -64,7 +62,7 @@ describe('download', () => {
6462
const install = new Install();
6563
const toolPath = await install.download(version, true);
6664
expect(fs.existsSync(toolPath)).toBe(true);
67-
});
65+
}, 100000);
6866

6967
// prettier-ignore
7068
test.each([
@@ -77,14 +75,12 @@ describe('download', () => {
7775
['linux', 's390x'],
7876
])(
7977
'acquires regclient for %s/%s', async (os, arch) => {
80-
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
81-
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
82-
const install = new Install();
83-
const regclientBin = await install.download('latest');
84-
expect(fs.existsSync(regclientBin)).toBe(true);
85-
},
86-
100000
87-
);
78+
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
79+
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
80+
const install = new Install();
81+
const regclientBin = await install.download('latest');
82+
expect(fs.existsSync(regclientBin)).toBe(true);
83+
}, 100000);
8884
});
8985

9086
describe('getDownloadVersion', () => {

__tests__/undock/install.test.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ describe('download', () => {
3737
['latest']
3838
])(
3939
'acquires %p of undock', async (version) => {
40-
const install = new Install();
41-
const toolPath = await install.download(version);
42-
expect(fs.existsSync(toolPath)).toBe(true);
43-
const undockBin = await install.install(toolPath, tmpDir);
44-
expect(fs.existsSync(undockBin)).toBe(true);
45-
},
46-
100000
47-
);
40+
const install = new Install();
41+
const toolPath = await install.download(version);
42+
expect(fs.existsSync(toolPath)).toBe(true);
43+
const undockBin = await install.install(toolPath, tmpDir);
44+
expect(fs.existsSync(undockBin)).toBe(true);
45+
}, 100000);
4846

4947
// prettier-ignore
5048
test.each([
@@ -56,7 +54,7 @@ describe('download', () => {
5654
const install = new Install();
5755
const toolPath = await install.download(version);
5856
expect(fs.existsSync(toolPath)).toBe(true);
59-
});
57+
}, 100000);
6058

6159
// prettier-ignore
6260
test.each([
@@ -67,7 +65,7 @@ describe('download', () => {
6765
const install = new Install();
6866
const toolPath = await install.download(version, true);
6967
expect(fs.existsSync(toolPath)).toBe(true);
70-
});
68+
}, 100000);
7169

7270
// TODO: add tests for arm
7371
// prettier-ignore
@@ -82,14 +80,12 @@ describe('download', () => {
8280
['linux', 's390x'],
8381
])(
8482
'acquires undock for %s/%s', async (os, arch) => {
85-
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
86-
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
87-
const install = new Install();
88-
const undockBin = await install.download('latest');
89-
expect(fs.existsSync(undockBin)).toBe(true);
90-
},
91-
100000
92-
);
83+
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
84+
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
85+
const install = new Install();
86+
const undockBin = await install.download('latest');
87+
expect(fs.existsSync(undockBin)).toBe(true);
88+
}, 100000);
9389
});
9490

9591
describe('getDownloadVersion', () => {

0 commit comments

Comments
 (0)