mirror of https://github.com/actions/toolkit
Concurrency has a min of 1
parent
ede05b95d7
commit
d4385a64a7
|
@ -85,6 +85,14 @@ describe('uploadConcurrencyEnv', () => {
|
|||
}).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', () => {
|
||||
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
|
||||
process.env.ACTIONS_UPLOAD_CONCURRENCY = '40'
|
||||
|
|
|
@ -61,7 +61,7 @@ export function getConcurrency(): number {
|
|||
const concurrencyOverride = process.env['ACTIONS_UPLOAD_CONCURRENCY']
|
||||
if (concurrencyOverride) {
|
||||
const concurrency = parseInt(concurrencyOverride)
|
||||
if (isNaN(concurrency)) {
|
||||
if (isNaN(concurrency) || concurrency < 1) {
|
||||
throw new Error(
|
||||
'Invalid value set for ACTIONS_UPLOAD_CONCURRENCY env variable'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue