|
3 | 3 | // SPDX short identifier: MIT |
4 | 4 |
|
5 | 5 | import * as os from 'os'; |
| 6 | +import * as crypto from 'crypto'; |
6 | 7 | import * as toolcache from '@actions/tool-cache'; |
7 | 8 | import * as core from '@actions/core'; |
8 | 9 | import * as path from 'path' |
@@ -46,7 +47,7 @@ var toolsCacheDir = jest.spyOn(toolcache, 'cacheDir'); |
46 | 47 | var toolsFind = jest.spyOn(toolcache, 'find'); |
47 | 48 |
|
48 | 49 | test('testing get-cmake action success with cloud/local cache enabled', async () => { |
49 | | - const testId = Math.random(); |
| 50 | + const testId = crypto.randomBytes(16).toString('hex'); |
50 | 51 | process.env.RUNNER_TEMP = path.join(os.tmpdir(), `${testId}`); |
51 | 52 | process.env.RUNNER_TOOL_CACHE = path.join(os.tmpdir(), `${testId}-cache`); |
52 | 53 |
|
@@ -78,7 +79,7 @@ test('testing get-cmake action success with cloud/local cache enabled', async () |
78 | 79 | }); |
79 | 80 |
|
80 | 81 | test('testing get-cmake action success with local or cloud cache hits', async () => { |
81 | | - const testId = Math.random(); |
| 82 | + const testId = crypto.randomBytes(16).toString('hex'); |
82 | 83 | process.env.RUNNER_TEMP = path.join(os.tmpdir(), `${testId}`); |
83 | 84 | process.env.RUNNER_TOOL_CACHE = path.join(os.tmpdir(), `${testId}-cache`); |
84 | 85 |
|
@@ -121,7 +122,7 @@ test('testing get-cmake action store and restore local cache', async () => { |
121 | 122 | toolsCacheDir.mockRestore(); |
122 | 123 | toolsFind.mockRestore(); |
123 | 124 |
|
124 | | - const testId = Math.random(); |
| 125 | + const testId = crypto.randomBytes(16).toString('hex'); |
125 | 126 | process.env.RUNNER_TEMP = path.join(os.tmpdir(), `${testId}`); |
126 | 127 | process.env.RUNNER_TOOL_CACHE = path.join(os.tmpdir(), `${testId}-cache`); |
127 | 128 | let downloadMock = undefined; |
|
0 commit comments