Skip to content

Commit fc8786b

Browse files
authored
Update e2e tests and e2e test infrastructure (#414)
1 parent 920b830 commit fc8786b

File tree

10 files changed

+167
-170
lines changed

10 files changed

+167
-170
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
3.0.x
3434
- name: Verify dotnet
3535
shell: pwsh
36-
run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404 '3.0'
36+
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2.402$", "^3.1.404$", "^3.0"
3737

3838
test-setup-full-version:
3939
runs-on: ${{ matrix.operating-system }}
@@ -60,13 +60,9 @@ jobs:
6060
source-url: https://api.nuget.org/v3/index.json
6161
env:
6262
NUGET_AUTH_TOKEN: NOTATOKEN
63-
- name: Verify nuget config file
64-
shell: pwsh
65-
run: |
66-
if (-Not (Test-Path "../nuget.config")) { throw "nuget file not generated correctly" }
6763
- name: Verify dotnet
6864
shell: pwsh
69-
run: __tests__/verify-dotnet.ps1 3.1.201 2.2.402
65+
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1.201$", "^2.2.402$" -CheckNugetConfig
7066

7167
test-setup-without-patch-version:
7268
runs-on: ${{ matrix.operating-system }}
@@ -91,7 +87,7 @@ jobs:
9187
dotnet-version: '2.2'
9288
- name: Verify dotnet
9389
shell: pwsh
94-
run: __tests__/verify-dotnet.ps1 3.1 2.2
90+
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1", "^2.2"
9591

9692
test-setup-prerelease-version:
9793
runs-on: ${{ matrix.operating-system }}
@@ -105,17 +101,13 @@ jobs:
105101
- name: Clear toolcache
106102
shell: pwsh
107103
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
108-
- name: Setup dotnet '2.2'
109-
uses: ./
110-
with:
111-
dotnet-version: '2.2'
112104
- name: Setup dotnet '3.1.100-preview1-014459'
113105
uses: ./
114106
with:
115107
dotnet-version: '3.1.100-preview1-014459'
116108
- name: Verify dotnet
117109
shell: pwsh
118-
run: __tests__/verify-dotnet.ps1 3.1.100-preview1-014459
110+
run: __tests__/verify-dotnet.ps1 -Patterns "3.1.100-preview1-014459"
119111

120112
test-setup-latest-patch-version:
121113
runs-on: ${{ matrix.operating-system }}
@@ -139,7 +131,7 @@ jobs:
139131
dotnet-version: 2.2.X
140132
- name: Verify dotnet
141133
shell: pwsh
142-
run: __tests__/verify-dotnet.ps1 '2.2' '3.1'
134+
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2", "^3.1"
143135

144136
test-setup-with-wildcard:
145137
runs-on: ${{ matrix.operating-system }}
@@ -163,7 +155,7 @@ jobs:
163155
dotnet-version: 2.2.*
164156
- name: Verify dotnet
165157
shell: pwsh
166-
run: __tests__/verify-dotnet.ps1 3.1 2.2
158+
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1", "^2.2"
167159

168160
test-setup-global-json-specified-and-version:
169161
runs-on: ${{ matrix.operating-system }}
@@ -181,15 +173,15 @@ jobs:
181173
shell: bash
182174
run: |
183175
mkdir subdirectory
184-
echo '{"sdk":{"version": "2.2","rollForward": "latestFeature"}}' > ./subdirectory/global.json
176+
echo '{"sdk":{"version": "2.2.207","rollForward": "latestFeature"}}' > ./subdirectory/global.json
185177
- name: Setup dotnet
186178
uses: ./
187179
with:
188180
dotnet-version: 3.1
189181
global-json-file: ./subdirectory/global.json
190182
- name: Verify dotnet
191183
shell: pwsh
192-
run: __tests__/verify-dotnet.ps1 2.2 3.1
184+
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2", "^3.1"
193185

194186
test-setup-with-dotnet-quality:
195187
runs-on: ${{ matrix.operating-system }}
@@ -209,12 +201,9 @@ jobs:
209201
with:
210202
dotnet-version: '7.0'
211203
dotnet-quality: 'preview'
212-
- name: Verify preview version
204+
- name: Verify dotnet
213205
shell: pwsh
214-
run: |
215-
$version = & dotnet --version
216-
Write-Host "Installed version: $version"
217-
if (-not ($version.Contains("preview") -or $version.Contains("rc"))) { throw "Unexpected version" }
206+
run: __tests__/verify-dotnet.ps1 -Patterns "^7\.0\.\d+-"
218207

219208
test-dotnet-version-output-during-single-version-installation:
220209
runs-on: ${{ matrix.operating-system }}
@@ -273,7 +262,7 @@ jobs:
273262
test-proxy:
274263
runs-on: ubuntu-latest
275264
container:
276-
image: mcr.microsoft.com/dotnet/core/runtime-deps:3.0-bionic
265+
image: ubuntu:latest
277266
options: --dns 127.0.0.1
278267
services:
279268
squid-proxy:
@@ -286,21 +275,29 @@ jobs:
286275
steps:
287276
- name: Checkout
288277
uses: actions/checkout@v3
289-
- name: Clear tool cache
290-
run: rm -rf "/usr/share/dotnet"
291-
- name: Install curl
278+
- name: Install Powershell
292279
run: |
293-
apt update
294-
apt -y install curl
295-
- name: Setup dotnet 3.1.201
280+
apt-get update
281+
apt-get install -y wget apt-transport-https software-properties-common
282+
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
283+
dpkg -i packages-microsoft-prod.deb
284+
rm packages-microsoft-prod.deb
285+
apt-get update
286+
apt-get install -y powershell
287+
- name: Clear toolcache
288+
shell: pwsh
289+
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
290+
- name: Setup dotnet 6.0
296291
uses: ./
297292
with:
298-
dotnet-version: 3.1.201
293+
dotnet-version: 6.0
299294
source-url: https://api.nuget.org/v3/index.json
300295
env:
301296
NUGET_AUTH_TOKEN: NOTATOKEN
302297
- name: Verify dotnet
303-
run: __tests__/verify-dotnet.sh 3.1.201
298+
shell: pwsh
299+
run: |
300+
__tests__/verify-dotnet.ps1 -Patterns "^6.0" -CheckNugetConfig
304301
305302
test-bypass-proxy:
306303
runs-on: ubuntu-latest
@@ -310,8 +307,9 @@ jobs:
310307
steps:
311308
- name: Checkout
312309
uses: actions/checkout@v3
313-
- name: Clear tool cache
314-
run: rm -rf "/usr/share/dotnet"
310+
- name: Clear toolcache
311+
shell: pwsh
312+
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
315313
- name: Setup dotnet 3.1.201
316314
uses: ./
317315
with:
@@ -320,4 +318,5 @@ jobs:
320318
env:
321319
NUGET_AUTH_TOKEN: NOTATOKEN
322320
- name: Verify dotnet
323-
run: __tests__/verify-dotnet.sh 3.1.201
321+
shell: pwsh
322+
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1.201$" -CheckNugetConfig

.github/workflows/test-dotnet.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
21-
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
21+
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0']
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v3
@@ -29,9 +29,7 @@ jobs:
2929
uses: ./
3030
with:
3131
dotnet-version: ${{ matrix.dotnet-version }}
32-
- name: Check installed version
32+
- name: Verify installed version
3333
shell: pwsh
3434
run: |
35-
$version = & dotnet --version
36-
Write-Host "Installed version: $version"
37-
if (-not $version.StartsWith("${{ matrix.dotnet-version }}")) { throw "Unexpected version" }
35+
__tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}"

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ global.json
33
lib/
44
node_modules/
55
__tests__/runner/*
6-
__tests__/sample-csproj/bin/
7-
__tests__/sample-csproj/obj/
6+
__tests__/e2e-test-csproj/bin/
7+
__tests__/e2e-test-csproj/obj/
88

99
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
1010
# Logs

__tests__/e2e-test-csproj/Test.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using System;
3+
4+
namespace test_csproj
5+
{
6+
[TestClass]
7+
public class Test
8+
{
9+
[TestMethod]
10+
public void TestMethod()
11+
{
12+
Console.WriteLine("TestMethod");
13+
int calculatedResult = 1000 / 25;
14+
int expectedResult = 40;
15+
Assert.AreEqual(calculatedResult, expectedResult);
16+
}
17+
}
18+
}

__tests__/e2e-test-csproj/test.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(TEST_TARGET_FRAMEWORK)</TargetFramework>
5+
<IsPackable>false</IsPackable>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<!-- These packages will be downloaded over the network for testing proxy settings -->
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170810-02" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
12+
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
13+
</ItemGroup>
14+
15+
</Project>

__tests__/sample-csproj/Program.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

__tests__/sample-csproj/sample.csproj

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)