test/integration: fix more tests in windows
Linting test
- use 'timeout' instead of 'sleep' in Windows
Test diffUtils.getEditsFromUnifiedDiffStr
- the test calls 'diff' that is not available in Windows.
Skip it.
Installation tests
- use the correct binary name when checking whether installation
has succeeded. Windows binaries use '.exe'.
- correct the file proxy url.
- file paths in zip should always use /. path.join cleans up
to use the platform specific separators.
Updates golang/vscode-go#239
Change-Id: Idcb2f29145e425d70ddd04970fa8c0b1fe2c82b0
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/244768
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/test/integration/extension.test.ts b/test/integration/extension.test.ts
index d168983..269e6e8 100644
--- a/test/integration/extension.test.ts
+++ b/test/integration/extension.test.ts
@@ -374,8 +374,8 @@
buildOnSave: { value: 'package' },
lintOnSave: { value: 'package' },
// simulate a long running lint process by sleeping for a couple seconds
- lintTool: { value: 'sleep' },
- lintFlags: { value: ['2'] }
+ lintTool: { value: process.platform !== 'win32' ? 'sleep' : 'timeout' },
+ lintFlags: { value: process.platform !== 'win32' ? ['2'] : ['/t', 2] }
});
const results = await Promise.all([
@@ -473,7 +473,12 @@
assert.equal(testFileGenerated, true, 'Test file not generated.');
});
- test('Test diffUtils.getEditsFromUnifiedDiffStr', async () => {
+ test('Test diffUtils.getEditsFromUnifiedDiffStr', async function () {
+ if (process.platform === 'win32') {
+ // This test requires diff tool that's not available on windows
+ this.skip();
+ }
+
const file1path = path.join(fixturePath, 'diffTest1Data', 'file1.go');
const file2path = path.join(fixturePath, 'diffTest1Data', 'file2.go');
const file1uri = vscode.Uri.file(file1path);
diff --git a/test/integration/install.test.ts b/test/integration/install.test.ts
index 395ae46..e61f606 100644
--- a/test/integration/install.test.ts
+++ b/test/integration/install.test.ts
@@ -10,12 +10,14 @@
import os = require('os');
import path = require('path');
import sinon = require('sinon');
+import url = require('url');
import util = require('util');
import vscode = require('vscode');
import { toolInstallationEnvironment } from '../../src/goEnv';
import { installTools } from '../../src/goInstallTools';
import { allToolsInformation, getTool, getToolAtVersion } from '../../src/goTools';
import { getBinPath, getGoVersion, rmdirRecursive } from '../../src/util';
+import { correctBinname } from '../../src/utils/goPath';
suite('Installation Tests', function () {
// Disable timeout when we are running slow tests.
@@ -71,7 +73,7 @@
const goConfig = Object.create(vscode.workspace.getConfiguration('go'), {
toolsEnvVars: {
value: {
- GOPROXY: `file://${proxyDir}`,
+ GOPROXY: url.pathToFileURL(proxyDir),
GOSUMDB: 'off',
}
},
@@ -93,7 +95,7 @@
for (const tool of testCases) {
checks.push(new Promise<void>(async (resolve) => {
// Check that the expect tool has been installed to $GOPATH/bin.
- const ok = await exists(path.join(tmpToolsGopath, 'bin', tool));
+ const ok = await exists(path.join(tmpToolsGopath, 'bin', correctBinname(tool)));
if (!ok) {
assert.fail(`expected ${tmpToolsGopath}/bin/${tool}, not found`);
}
@@ -152,7 +154,7 @@
// Write the zip file.
const zip = new AdmZip();
const content = `package main; func main() {};`;
- zip.addFile(path.join(`${module}@${version}`, 'main.go'), Buffer.alloc(content.length, content));
+ zip.addFile(`${module}@${version}/main.go`, Buffer.alloc(content.length, content));
zip.writeZip(path.join(dir, `${version}.zip`));
}
return proxyDir;