mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-01-03 14:42:56 +08:00
Concurrency has a min of 1
This commit is contained in:
parent
ede05b95d7
commit
d4385a64a7
@ -85,6 +85,14 @@ describe('uploadConcurrencyEnv', () => {
|
|||||||
}).toThrow()
|
}).toThrow()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should throw if ACTIONS_UPLOAD_CONCURRENCY is < 1', () => {
|
||||||
|
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
|
||||||
|
process.env.ACTIONS_UPLOAD_CONCURRENCY = '0'
|
||||||
|
expect(() => {
|
||||||
|
config.getConcurrency()
|
||||||
|
}).toThrow()
|
||||||
|
})
|
||||||
|
|
||||||
it('cannot go over currency cap when override value is greater', () => {
|
it('cannot go over currency cap when override value is greater', () => {
|
||||||
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
|
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
|
||||||
process.env.ACTIONS_UPLOAD_CONCURRENCY = '40'
|
process.env.ACTIONS_UPLOAD_CONCURRENCY = '40'
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export function getConcurrency(): number {
|
|||||||
const concurrencyOverride = process.env['ACTIONS_UPLOAD_CONCURRENCY']
|
const concurrencyOverride = process.env['ACTIONS_UPLOAD_CONCURRENCY']
|
||||||
if (concurrencyOverride) {
|
if (concurrencyOverride) {
|
||||||
const concurrency = parseInt(concurrencyOverride)
|
const concurrency = parseInt(concurrencyOverride)
|
||||||
if (isNaN(concurrency)) {
|
if (isNaN(concurrency) || concurrency < 1) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Invalid value set for ACTIONS_UPLOAD_CONCURRENCY env variable'
|
'Invalid value set for ACTIONS_UPLOAD_CONCURRENCY env variable'
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user