@@ -56,22 +56,30 @@ describe('uploadChunkTimeoutEnv', () => {
56
56
} )
57
57
58
58
describe ( 'uploadConcurrencyEnv' , ( ) => {
59
- it ( 'should return default 32 when cpu num is <= 4 ' , ( ) => {
59
+ it ( 'Concurrency default to 5 ' , ( ) => {
60
60
; ( os . cpus as jest . Mock ) . mockReturnValue ( new Array ( 4 ) )
61
+ expect ( config . getConcurrency ( ) ) . toBe ( 5 )
62
+ } )
63
+
64
+ it ( 'Concurrency max out at 300 on systems with many CPUs' , ( ) => {
65
+ ; ( os . cpus as jest . Mock ) . mockReturnValue ( new Array ( 32 ) )
66
+ process . env . ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '301'
67
+ expect ( config . getConcurrency ( ) ) . toBe ( 300 )
68
+ } )
69
+
70
+ it ( 'Concurrency can be set to 32 when cpu num is <= 4' , ( ) => {
71
+ ; ( os . cpus as jest . Mock ) . mockReturnValue ( new Array ( 4 ) )
72
+ process . env . ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '32'
61
73
expect ( config . getConcurrency ( ) ) . toBe ( 32 )
62
74
} )
63
75
64
- it ( 'should return 16 * num of cpu when cpu num is > 4' , ( ) => {
76
+ it ( 'Concurrency can be set 16 * num of cpu when cpu num is > 4' , ( ) => {
65
77
; ( os . cpus as jest . Mock ) . mockReturnValue ( new Array ( 6 ) )
78
+ process . env . ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '96'
66
79
expect ( config . getConcurrency ( ) ) . toBe ( 96 )
67
80
} )
68
81
69
- it ( 'should return up to 300 max value' , ( ) => {
70
- ; ( os . cpus as jest . Mock ) . mockReturnValue ( new Array ( 32 ) )
71
- expect ( config . getConcurrency ( ) ) . toBe ( 300 )
72
- } )
73
-
74
- it ( 'should return override value when ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is set' , ( ) => {
82
+ it ( 'Concurrency can be overridden by env var ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY' , ( ) => {
75
83
; ( os . cpus as jest . Mock ) . mockReturnValue ( new Array ( 4 ) )
76
84
process . env . ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '10'
77
85
expect ( config . getConcurrency ( ) ) . toBe ( 10 )
@@ -92,10 +100,4 @@ describe('uploadConcurrencyEnv', () => {
92
100
config . getConcurrency ( )
93
101
} ) . toThrow ( )
94
102
} )
95
-
96
- it ( 'cannot go over currency cap when override value is greater' , ( ) => {
97
- ; ( os . cpus as jest . Mock ) . mockReturnValue ( new Array ( 4 ) )
98
- process . env . ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '40'
99
- expect ( config . getConcurrency ( ) ) . toBe ( 32 )
100
- } )
101
103
} )
0 commit comments