Skip to content

Commit

Permalink
Reenable disabled tests post VSCode refresh (microsoft#20899)
Browse files Browse the repository at this point in the history
* Reenable disabled tests

* Extension unit test updates

* Turn off data workspace tests on Linux

* Keep integration and smoke tests disabled
  • Loading branch information
kburtram authored Oct 22, 2022
1 parent 3e1f2b0 commit 5a7ae8a
Show file tree
Hide file tree
Showing 12 changed files with 342 additions and 95 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ jobs:
id: electron-unit-tests
run: DISPLAY=:10 ./scripts/test.sh --runGlob "**/sql/**/*.test.js" --coverage

# {{SQL CARBON TODO}} - reenable
# - name: Run Extension Unit Tests (Electron)
# id: electron-extension-unit-tests
# run: DISPLAY=:10 ./scripts/test-extensions-unit.sh
- name: Run Extension Unit Tests (Electron)
id: electron-extension-unit-tests
run: DISPLAY=:10 ./scripts/test-extensions-unit.sh

# {{SQL CARBON EDIT}} Add coveralls. We merge first to get around issue where parallel builds weren't being combined correctly
- name: Combine code coverage files
Expand Down
4 changes: 2 additions & 2 deletions build/azure-pipelines/darwin/sql-product-build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ steps:
displayName: Run unit tests
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
# {{SQL CARBON TODO}} - disable while investigating
# {{SQL CARBON TODO}} - reenable
# - script: |
# # Figure out the full absolute path of the product we just built
# # including the remote server and configure the integration tests
Expand All @@ -134,7 +134,7 @@ steps:
# Per https://developercommunity.visualstudio.com/t/variablesexpressions-dont-work-with-continueonerro/1187733 we can't use variables
# in continueOnError directly so instead make two copies of the task and only run one or the other based on the SMOKE_FAIL_ON_ERROR value
# {{SQL CARBON TODO}} - turn off smoke tests
# {{SQL CARBON TODO}} -- reenable
# - script: |
# set -e
# APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-$(VSCODE_ARCH)
Expand Down
71 changes: 34 additions & 37 deletions build/azure-pipelines/linux/sql-product-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ steps:
displayName: Run unit tests (Electron)
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSIONS_ONLY'], 'true'))
# {{SQL CARBON TODO}} - disable while investigating
# {{SQL CARBON TODO}} -- reenable
# - script: |
# # Figure out the full absolute path of the product we just built
# # including the remote server and configure the integration tests
Expand All @@ -137,35 +137,33 @@ steps:
# displayName: Run integration tests (Electron)
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSIONS_ONLY'], 'true'))

# {{SQL CARBON TODO}} - reenable
# - script: |
# # Figure out the full absolute path of the product we just built
# # including the remote server and configure the unit tests
# # to run with these builds instead of running out of sources.
# set -e
# APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
# APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
# INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
# NO_CLEANUP=1 \
# VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
# DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests"
# displayName: 'Run Extension Unit Tests'
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
- script: |
# Figure out the full absolute path of the product we just built
# including the remote server and configure the unit tests
# to run with these builds instead of running out of sources.
set -e
APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
NO_CLEANUP=1 \
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests"
displayName: 'Run Extension Unit Tests'
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
# {{SQL CARBON TODO}}
# - bash: |
# set -e
# mkdir -p $(Build.ArtifactStagingDirectory)/logs/linux-x64
# cd /tmp
# for folder in adsuser*/
# do
# folder=${folder%/}
# # Only archive directories we want for debugging purposes
# tar -czvf $(Build.ArtifactStagingDirectory)/logs/linux-x64/$folder.tar.gz $folder/User $folder/logs
# done
# displayName: Archive Logs
# continueOnError: true
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
- bash: |
set -e
mkdir -p $(Build.ArtifactStagingDirectory)/logs/linux-x64
cd /tmp
for folder in adsuser*/
do
folder=${folder%/}
# Only archive directories we want for debugging purposes
tar -czvf $(Build.ArtifactStagingDirectory)/logs/linux-x64/$folder.tar.gz $folder/User $folder/logs
done
displayName: Archive Logs
continueOnError: true
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
- script: |
set -e
Expand Down Expand Up @@ -223,14 +221,13 @@ steps:
./build/azure-pipelines/linux/createDrop.sh
displayName: Create Drop
# {{SQL CARBON TODO}}
# - script: |
# set -e
# shopt -s globstar
# mkdir -p $(Build.ArtifactStagingDirectory)/test-results/coverage
# cp --parents -r $(Build.SourcesDirectory)/extensions/*/coverage/** $(Build.ArtifactStagingDirectory)/test-results/coverage
# displayName: Copy Coverage
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
- script: |
set -e
shopt -s globstar
mkdir -p $(Build.ArtifactStagingDirectory)/test-results/coverage
cp --parents -r $(Build.SourcesDirectory)/extensions/*/coverage/** $(Build.ArtifactStagingDirectory)/test-results/coverage
displayName: Copy Coverage
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
- task: PublishTestResults@2
displayName: 'Publish Test Results test-results.xml'
Expand Down
43 changes: 21 additions & 22 deletions build/azure-pipelines/win32/product-build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,28 +183,27 @@ steps:
timeoutInMinutes: 20
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
# {{SQL CARBON TODO}} - disable while investigating
# - powershell: |
# # Figure out the full absolute path of the product we just built
# # including the remote server and configure the integration tests
# # to run with these builds instead of running out of sources.
# . build/azure-pipelines/win32/exec.ps1
# $ErrorActionPreference = "Stop"
# $AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
# $AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
# $AppNameShort = $AppProductJson.nameShort
# exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-integration.bat --build --tfs "Integration Tests" }
# displayName: Run integration tests (Electron)
# timeoutInMinutes: 20
# condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
# {{SQL CARBON TODO}} - disable while investigating
# - powershell: |
# . build/azure-pipelines/win32/exec.ps1
# $ErrorActionPreference = "Stop"
# exec { $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"; .\scripts\test-web-integration.bat --browser firefox }
# displayName: Run integration tests (Browser, Firefox)
# timeoutInMinutes: 20
# condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
- powershell: |
# Figure out the full absolute path of the product we just built
# including the remote server and configure the integration tests
# to run with these builds instead of running out of sources.
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
$AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
$AppNameShort = $AppProductJson.nameShort
exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-integration.bat --build --tfs "Integration Tests" }
displayName: Run integration tests (Electron)
timeoutInMinutes: 20
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
- powershell: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
exec { $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"; .\scripts\test-web-integration.bat --browser firefox }
displayName: Run integration tests (Browser, Firefox)
timeoutInMinutes: 20
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
- powershell: |
. build/azure-pipelines/win32/exec.ps1
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines/win32/sql-product-build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ steps:
# displayName: Run unit tests (Electron)
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))

# {{SQL CARBON TODO}} - disable while investigating
# {{SQL CARBON TODO}} -- reenable
# - powershell: |
# # Figure out the full absolute path of the product we just built
# # including the remote server and configure the integration tests
Expand Down
13 changes: 13 additions & 0 deletions extensions/admin-tool-ext-win/src/test/extension.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import 'mocha';
import * as vscode from 'vscode';

describe('Extension activate test', () => {
it('Extension should activate correctly', async function (): Promise<void> {
await vscode.extensions.getExtension('Microsoft.admin-tool-ext-win')!.activate();
});
});
6 changes: 2 additions & 4 deletions extensions/data-workspace/src/test/workspaceService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ suite('WorkspaceService', function (): void {
}
]);
sinon.stub(ProjectProviderRegistry, 'providers').value([provider1, provider2]);
// const consoleErrorStub = sinon.stub(console, 'error');
const consoleErrorStub = sinon.stub(console, 'error');
const projectTypes = await service.getAllProjectTypes();
should.strictEqual(projectTypes.length, 3);
should.strictEqual(projectTypes[0].projectFileExtension, 'testproj');
Expand All @@ -175,9 +175,7 @@ suite('WorkspaceService', function (): void {
should.strictEqual(extension5.activationStub.called, true, 'extension5.activate() should have been called');
should.strictEqual(extension6.activationStub.notCalled, true, 'extension6.activate() should not have been called');
should.strictEqual(extension7.activationStub.notCalled, true, 'extension7.activate() should not have been called');

// {{SQL CARBON TODO}} - disable this assertion
// should.strictEqual(consoleErrorStub.calledOnce, true, 'Logger.error should be called once');
should.strictEqual(consoleErrorStub.calledOnce, true, 'Logger.error should be called once');
});

test('getProjectProvider', async () => {
Expand Down
4 changes: 2 additions & 2 deletions extensions/mssql/src/test/util/dataCache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('DataItemCache', function (): void {
});

it('Should be initialized empty', function (): void {
should(dataItemCache).not.have.property('cachedItem').and.be.undefined();
should(dataItemCache).property('cachedItem').be.undefined();
});

it('Should be initialized as expired', function (): void {
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('DataItemCache', function (): void {
await dataItemCache.getData();
await dataItemCache.getData();

fetchFunctionMock.verify(fx => fx() ,TypeMoq.Times.once());
fetchFunctionMock.verify(fx => fx(), TypeMoq.Times.once());
});

it('Should call fetch function twice for consecutive getValue() calls if TTL expires in between', async function (): Promise<void> {
Expand Down
Loading

0 comments on commit 5a7ae8a

Please sign in to comment.