test(github): generate random filename
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,7 @@ import {Build} from '../src/buildx/build';
|
|||||||
import {Exec} from '../src/exec';
|
import {Exec} from '../src/exec';
|
||||||
import {GitHub} from '../src/github';
|
import {GitHub} from '../src/github';
|
||||||
import {History} from '../src/buildx/history';
|
import {History} from '../src/buildx/history';
|
||||||
|
import {Util} from '../src/util';
|
||||||
|
|
||||||
const fixturesDir = path.join(__dirname, '.fixtures');
|
const fixturesDir = path.join(__dirname, '.fixtures');
|
||||||
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'github-itg-'));
|
const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'github-itg-'));
|
||||||
@@ -33,8 +34,10 @@ const maybe = !process.env.GITHUB_ACTIONS || (process.env.GITHUB_ACTIONS === 'tr
|
|||||||
|
|
||||||
maybe('uploadArtifact', () => {
|
maybe('uploadArtifact', () => {
|
||||||
it('uploads an artifact', async () => {
|
it('uploads an artifact', async () => {
|
||||||
|
const filename = path.join(tmpDir, `github-repo-${Util.generateRandomString()}.json`);
|
||||||
|
fs.copyFileSync(path.join(fixturesDir, `github-repo.json`), filename);
|
||||||
const res = await GitHub.uploadArtifact({
|
const res = await GitHub.uploadArtifact({
|
||||||
filename: path.join(fixturesDir, 'github-repo.json'),
|
filename: filename,
|
||||||
mimeType: 'application/json',
|
mimeType: 'application/json',
|
||||||
retentionDays: 1
|
retentionDays: 1
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user