mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 18:06:45 +00:00
fixed a problem where key cleanup happened before import
This commit is contained in:
parent
e09c5c7b0c
commit
1a5aa64e84
4 changed files with 43 additions and 30 deletions
1
__tests__/.gpgtmp/private.asc
Normal file
1
__tests__/.gpgtmp/private.asc
Normal file
|
@ -0,0 +1 @@
|
|||
KEY CONTENTS
|
|
@ -22,8 +22,8 @@ import * as auth from '../src/auth';
|
|||
const env = process.env;
|
||||
const m2Dir = path.join(__dirname, auth.M2_DIR);
|
||||
const settingsFile = path.join(m2Dir, auth.SETTINGS_FILE);
|
||||
const gpgDir = path.join(__dirname, auth.GPG_DIR);
|
||||
const gpgFile = auth.GPG_FILE;
|
||||
const privateKeyDir = path.join(__dirname, auth.PRIVATE_KEY_DIR);
|
||||
const privateKeyFile = auth.PRIVATE_KEY_FILE;
|
||||
|
||||
describe('auth tests', () => {
|
||||
beforeEach(async () => {
|
||||
|
@ -33,7 +33,7 @@ describe('auth tests', () => {
|
|||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(m2Dir);
|
||||
await io.rmRF(gpgDir);
|
||||
await io.rmRF(privateKeyDir);
|
||||
} catch {
|
||||
console.log('Failed to remove test directories');
|
||||
}
|
||||
|
@ -182,11 +182,11 @@ describe('auth tests', () => {
|
|||
|
||||
expect(exec.exec).toHaveBeenCalledWith(
|
||||
'gpg',
|
||||
['--import', '--batch', gpgFile],
|
||||
{cwd: gpgDir}
|
||||
['--import', '--batch', privateKeyFile],
|
||||
{cwd: privateKeyDir}
|
||||
);
|
||||
|
||||
expect(fs.existsSync(gpgDir)).toBe(false);
|
||||
expect(fs.existsSync(privateKeyDir)).toBe(false);
|
||||
}, 100000);
|
||||
|
||||
it('does not import gpg private key when private key is not set', async () => {
|
||||
|
@ -198,10 +198,10 @@ describe('auth tests', () => {
|
|||
|
||||
expect(exec.exec).not.toHaveBeenCalledWith(
|
||||
'gpg',
|
||||
['--import', '--batch', gpgFile],
|
||||
{cwd: gpgDir}
|
||||
['--import', '--batch', privateKeyFile],
|
||||
{cwd: privateKeyDir}
|
||||
);
|
||||
|
||||
expect(fs.existsSync(gpgDir)).toBe(false);
|
||||
expect(fs.existsSync(privateKeyDir)).toBe(false);
|
||||
}, 100000);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue