@@ -11,36 +11,30 @@ const testFilePath = path.join(TEST_TEMP_DIR, 'test.bin')
11
11
12
12
const MB = 1024 * 1024
13
13
14
- const versions = [ 'v2' , 'v1' ] as const
15
-
16
- for ( const version of versions ) {
17
- describe ( `save and restore cache with @actions/cache package with api ${ version } ` , ( ) => {
18
- beforeAll ( ( ) => {
19
- if ( version !== 'v2' ) return
14
+ describe ( `save and restore cache with @actions/cache package` , ( ) => {
15
+ beforeAll ( ( ) => {
16
+ process . env . ACTIONS_CACHE_SERVICE_V2 = 'true'
17
+ process . env . ACTIONS_RUNTIME_TOKEN = 'mock-runtime-token'
18
+ } )
19
+ afterAll ( ( ) => {
20
+ delete process . env . ACTIONS_CACHE_SERVICE_V2
21
+ delete process . env . ACTIONS_RUNTIME_TOKEN
22
+ } )
20
23
21
- process . env . ACTIONS_CACHE_SERVICE_V2 = 'true'
22
- process . env . ACTIONS_RUNTIME_TOKEN = 'mock-runtime-token'
23
- } )
24
- afterAll ( ( ) => {
25
- delete process . env . ACTIONS_CACHE_SERVICE_V2
26
- delete process . env . ACTIONS_RUNTIME_TOKEN
24
+ for ( const size of [ 5 * MB , 50 * MB , 500 * MB , 1024 * MB ] )
25
+ test ( `${ size } Bytes` , { timeout : 90_000 } , async ( ) => {
26
+ // save
27
+ const expectedContents = crypto . randomBytes ( size )
28
+ await fs . writeFile ( testFilePath , expectedContents )
29
+ await saveCache ( [ testFilePath ] , 'cache-key' )
30
+ await fs . rm ( testFilePath )
31
+
32
+ // restore
33
+ const cacheHitKey = await restoreCache ( [ testFilePath ] , 'cache-key' )
34
+ expect ( cacheHitKey ) . toBe ( 'cache-key' )
35
+
36
+ // check contents
37
+ const restoredContents = await fs . readFile ( testFilePath )
38
+ expect ( restoredContents . compare ( expectedContents ) ) . toBe ( 0 )
27
39
} )
28
-
29
- for ( const size of [ 5 * MB , 50 * MB , 500 * MB , 1024 * MB ] )
30
- test ( `${ size } Bytes` , { timeout : 90_000 } , async ( ) => {
31
- // save
32
- const expectedContents = crypto . randomBytes ( size )
33
- await fs . writeFile ( testFilePath , expectedContents )
34
- await saveCache ( [ testFilePath ] , 'cache-key' )
35
- await fs . rm ( testFilePath )
36
-
37
- // restore
38
- const cacheHitKey = await restoreCache ( [ testFilePath ] , 'cache-key' )
39
- expect ( cacheHitKey ) . toBe ( 'cache-key' )
40
-
41
- // check contents
42
- const restoredContents = await fs . readFile ( testFilePath )
43
- expect ( restoredContents . compare ( expectedContents ) ) . toBe ( 0 )
44
- } )
45
- } )
46
- }
40
+ } )
0 commit comments