added test for .x syntax

This commit is contained in:
Alif Rachmawadi 2019-08-16 12:55:18 +07:00
parent 3f12dc48a0
commit aa2b146685
No known key found for this signature in database
GPG key ID: 79DA63C0F3A55BB1
2 changed files with 2500 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -2,9 +2,11 @@ import io = require('@actions/io');
import fs = require('fs'); import fs = require('fs');
import os = require('os'); import os = require('os');
import path = require('path'); import path = require('path');
import nock = require('nock');
const toolDir = path.join(__dirname, 'runner', 'tools'); const toolDir = path.join(__dirname, 'runner', 'tools');
const tempDir = path.join(__dirname, 'runner', 'temp'); const tempDir = path.join(__dirname, 'runner', 'temp');
const dataDir = path.join(__dirname, 'data');
process.env['RUNNER_TOOL_CACHE'] = toolDir; process.env['RUNNER_TOOL_CACHE'] = toolDir;
process.env['RUNNER_TEMP'] = tempDir; process.env['RUNNER_TEMP'] = tempDir;
@ -39,6 +41,22 @@ describe('installer tests', () => {
} }
}, 100000); }, 100000);
it('Acquires latest release version of go if using .x syntax and no matching version is installed', async () => {
nock('https://api.github.com')
.get('/repos/golang/go/git/refs/tags')
.replyWithFile(200, path.join(dataDir, 'golang-tags.json'));
await installer.getGo('1.10.x');
const goDir = path.join(toolDir, 'go', '1.10.8', os.arch());
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(goDir, 'bin', 'go.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(goDir, 'bin', 'go'))).toBe(true);
}
}, 100000);
it('Throws if no location contains correct go version', async () => { it('Throws if no location contains correct go version', async () => {
let thrown = false; let thrown = false;
try { try {