Skip to content

Commit

Permalink
test/integration: skip tests broken on windows
Browse files Browse the repository at this point in the history
Added affectedByIssue832 to clearly indicate the tests
that need to be fixed.

For golang#832
For golang#1788

Change-Id: Ied7dc9726b33f092ae93a1f11952f97fd1433337
  • Loading branch information
hyangah committed Jul 20, 2022
1 parent 9b44451 commit 5dd2f19
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 8 deletions.
29 changes: 23 additions & 6 deletions test/integration/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
import cp = require('child_process');
import os = require('os');
import { MockExtensionContext } from '../mocks/MockContext';
import { affectedByIssue832 } from './testutils';

const testAll = (isModuleMode: boolean) => {
const dummyCancellationSource = new vscode.CancellationTokenSource();
Expand Down Expand Up @@ -741,7 +742,10 @@ It returns the number of bytes written and any write error encountered.
assert.equal(interfaces[0].name, 'circle');
});

test('Test listPackages', async () => {
test('Test listPackages', async function () {
if (affectedByIssue832()) {
this.skip(); // timeout on windows
}
const uri = vscode.Uri.file(path.join(fixturePath, 'baseTest', 'test.go'));
const document = await vscode.workspace.openTextDocument(uri);
await vscode.window.showTextDocument(document);
Expand Down Expand Up @@ -793,7 +797,10 @@ It returns the number of bytes written and any write error encountered.
});
});

test('Workspace Symbols', () => {
test('Workspace Symbols', function () {
if (affectedByIssue832()) {
this.skip(); // frequent timeout on windows
}
const workspacePath = path.join(fixturePath, 'vendoring');
const configWithoutIgnoringFolders = Object.create(getGoConfig(), {
gotoSymbol: {
Expand Down Expand Up @@ -861,7 +868,11 @@ It returns the number of bytes written and any write error encountered.
return Promise.all([withIgnoringFolders, withoutIgnoringFolders, withIncludingGoroot, withoutIncludingGoroot]);
});

test('Test Completion', async () => {
test('Test Completion', async function () {
if (affectedByIssue832()) {
this.skip(); // timeout on windows
}

const printlnDoc = `Println formats using the default formats for its operands and writes to
standard output. Spaces are always added between operands and a newline is
appended. It returns the number of bytes written and any write error
Expand Down Expand Up @@ -911,7 +922,10 @@ encountered.
await Promise.all(promises);
});

test('Test Completion Snippets For Functions', async () => {
test('Test Completion Snippets For Functions', async function () {
if (affectedByIssue832()) {
this.skip(); // timeout on windows
}
const provider = new GoCompletionItemProvider();
const uri = vscode.Uri.file(path.join(fixturePath, 'completions', 'snippets.go'));
const baseConfig = getGoConfig();
Expand Down Expand Up @@ -1176,7 +1190,7 @@ encountered.
});

test('Test Completion on unimported packages', async function () {
if (isModuleMode) {
if (isModuleMode || affectedByIssue832()) {
this.skip();
}
// gocode-gomod does not handle unimported package completion.
Expand Down Expand Up @@ -1212,7 +1226,10 @@ encountered.
await Promise.all(promises);
});

test('Test Completion on unimported packages (multiple)', async () => {
test('Test Completion on unimported packages (multiple)', async function () {
if (affectedByIssue832()) {
this.skip();
}
const config = Object.create(getGoConfig(), {
gocodeFlags: { value: ['-builtin'] }
});
Expand Down
6 changes: 5 additions & 1 deletion test/integration/goDebug.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { killProcessTree, killProcess } from '../../src/utils/processUtils';
import getPort = require('get-port');
import util = require('util');
import { TimestampedLogger } from '../../src/goLogging';
import { affectedByIssue832 } from './testutils';

// For debugging test and streaming the trace instead of buffering, set this.
const PRINT_TO_CONSOLE = false;
Expand Down Expand Up @@ -1728,7 +1729,7 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean, withConsole?: string) =>
// has a chance to clean up.
// BUG(https://github.com/golang/vscode-go/issues/1993)
test('should cleanup when stopped', async function () {
if (!isDlvDap) {
if (!isDlvDap || affectedByIssue832()) {
this.skip();
}
const PROGRAM = path.join(DATA_ROOT, 'loop');
Expand Down Expand Up @@ -1990,6 +1991,9 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean, withConsole?: string) =>
});

suite('substitute path', () => {
if (affectedByIssue832()) {
return;
}
// TODO(suzmue): add unit tests for substitutePath.
let tmpDir: string;

Expand Down
4 changes: 4 additions & 0 deletions test/integration/goDebugConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { rmdirRecursive } from '../../src/util';
import goEnv = require('../../src/goEnv');
import { MockCfg } from '../mocks/MockCfg';
import { extensionId } from '../../src/const';
import { affectedByIssue832 } from './testutils';

suite('Debug Environment Variable Merge Test', () => {
const debugConfigProvider = new GoDebugConfigurationProvider();
Expand Down Expand Up @@ -630,6 +631,9 @@ suite('Debug Configuration With Invalid Program', () => {
});

suite('Debug Configuration Converts Relative Paths', () => {
if (affectedByIssue832()) {
return;
}
const debugConfigProvider = new GoDebugConfigurationProvider();

let workspaceDir = '';
Expand Down
6 changes: 5 additions & 1 deletion test/integration/goExplorer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { getConfiguredTools } from '../../src/goTools';
import { getGoVersion } from '../../src/util';
import { resolveHomeDir } from '../../src/utils/pathUtils';
import { MockExtensionContext } from '../mocks/MockContext';
import { affectedByIssue832 } from './testutils';

suite('GoExplorerProvider', () => {
const fixtureDir = path.join(__dirname, '../../../test/testdata/baseTest');
Expand All @@ -36,7 +37,10 @@ suite('GoExplorerProvider', () => {
assert.strictEqual(env.contextValue, 'go:explorer:envtree');
});

test('env tree items', async () => {
test('env tree items', async function () {
if (affectedByIssue832()) {
this.skip();
}
const [env] = await explorer.getChildren()!;
const [goenv, gomod] = (await explorer.getChildren(env)) as { key: string; value: string }[];
assert.strictEqual(goenv.key, 'GOENV');
Expand Down
10 changes: 10 additions & 0 deletions test/integration/goTest.explore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as config from '../../src/config';
import { GoTestResolver } from '../../src/goTest/resolve';
import * as testUtils from '../../src/testUtils';
import { GoTest } from '../../src/goTest/utils';
import { affectedByIssue832 } from './testutils';

type Files = Record<string, string | { contents: string; language: string }>;

Expand Down Expand Up @@ -56,6 +57,9 @@ async function forceResolve(resolver: GoTestResolver, item?: TestItem) {

suite('Go Test Explorer', () => {
suite('Document opened', () => {
if (affectedByIssue832()) {
return;
}
class DUT extends GoTestExplorer {
async _didOpen(doc: TextDocument) {
await this.didOpenTextDocument(doc);
Expand Down Expand Up @@ -113,6 +117,9 @@ suite('Go Test Explorer', () => {
});

suite('Document edited', async () => {
if (affectedByIssue832()) {
return;
}
class DUT extends GoTestExplorer {
async _didOpen(doc: TextDocument) {
await this.didOpenTextDocument(doc);
Expand Down Expand Up @@ -224,6 +231,9 @@ suite('Go Test Explorer', () => {
});

suite('settings', () => {
if (affectedByIssue832()) {
return;
}
const sandbox = sinon.createSandbox();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
4 changes: 4 additions & 0 deletions test/integration/goTest.resolve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { GoTestResolver } from '../../src/goTest/resolve';
import { GoTest, GoTestKind } from '../../src/goTest/utils';
import { MockTestController, MockTestWorkspace } from '../mocks/MockTest';
import { getSymbols_Regex, populateModulePathCache } from './goTest.utils';
import { affectedByIssue832 } from './testutils';

type Files = Record<string, string | { contents: string; language: string }>;

Expand All @@ -25,6 +26,9 @@ function setup(folders: string[], files: Files) {
}

suite('Go Test Resolver', () => {
if (affectedByIssue832()) {
return;
}
interface TC extends TestCase {
item?: ([string, string, GoTestKind] | [string, string, GoTestKind, string])[];
expect: string[];
Expand Down
3 changes: 3 additions & 0 deletions test/integration/testutils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function affectedByIssue832(): boolean {
return process.platform === 'win32';
}

0 comments on commit 5dd2f19

Please sign in to comment.