Skip to content

Commit

Permalink
Update e2e tests and e2e test infrastructure (actions#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanZosimov authored Apr 20, 2023
1 parent 920b830 commit fc8786b
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 170 deletions.
65 changes: 32 additions & 33 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
3.0.x
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404 '3.0'
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2.402$", "^3.1.404$", "^3.0"

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

test-setup-without-patch-version:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -91,7 +87,7 @@ jobs:
dotnet-version: '2.2'
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1 2.2
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1", "^2.2"

test-setup-prerelease-version:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -105,17 +101,13 @@ jobs:
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet '2.2'
uses: ./
with:
dotnet-version: '2.2'
- name: Setup dotnet '3.1.100-preview1-014459'
uses: ./
with:
dotnet-version: '3.1.100-preview1-014459'
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1.100-preview1-014459
run: __tests__/verify-dotnet.ps1 -Patterns "3.1.100-preview1-014459"

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

test-setup-with-wildcard:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -163,7 +155,7 @@ jobs:
dotnet-version: 2.2.*
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1 2.2
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1", "^2.2"

test-setup-global-json-specified-and-version:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -181,15 +173,15 @@ jobs:
shell: bash
run: |
mkdir subdirectory
echo '{"sdk":{"version": "2.2","rollForward": "latestFeature"}}' > ./subdirectory/global.json
echo '{"sdk":{"version": "2.2.207","rollForward": "latestFeature"}}' > ./subdirectory/global.json
- name: Setup dotnet
uses: ./
with:
dotnet-version: 3.1
global-json-file: ./subdirectory/global.json
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 2.2 3.1
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2", "^3.1"

test-setup-with-dotnet-quality:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -209,12 +201,9 @@ jobs:
with:
dotnet-version: '7.0'
dotnet-quality: 'preview'
- name: Verify preview version
- name: Verify dotnet
shell: pwsh
run: |
$version = & dotnet --version
Write-Host "Installed version: $version"
if (-not ($version.Contains("preview") -or $version.Contains("rc"))) { throw "Unexpected version" }
run: __tests__/verify-dotnet.ps1 -Patterns "^7\.0\.\d+-"

test-dotnet-version-output-during-single-version-installation:
runs-on: ${{ matrix.operating-system }}
Expand Down Expand Up @@ -273,7 +262,7 @@ jobs:
test-proxy:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/core/runtime-deps:3.0-bionic
image: ubuntu:latest
options: --dns 127.0.0.1
services:
squid-proxy:
Expand All @@ -286,21 +275,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear tool cache
run: rm -rf "/usr/share/dotnet"
- name: Install curl
- name: Install Powershell
run: |
apt update
apt -y install curl
- name: Setup dotnet 3.1.201
apt-get update
apt-get install -y wget apt-transport-https software-properties-common
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt-get update
apt-get install -y powershell
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 6.0
uses: ./
with:
dotnet-version: 3.1.201
dotnet-version: 6.0
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: NOTATOKEN
- name: Verify dotnet
run: __tests__/verify-dotnet.sh 3.1.201
shell: pwsh
run: |
__tests__/verify-dotnet.ps1 -Patterns "^6.0" -CheckNugetConfig
test-bypass-proxy:
runs-on: ubuntu-latest
Expand All @@ -310,8 +307,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear tool cache
run: rm -rf "/usr/share/dotnet"
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 3.1.201
uses: ./
with:
Expand All @@ -320,4 +318,5 @@ jobs:
env:
NUGET_AUTH_TOKEN: NOTATOKEN
- name: Verify dotnet
run: __tests__/verify-dotnet.sh 3.1.201
shell: pwsh
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1.201$" -CheckNugetConfig
8 changes: 3 additions & 5 deletions .github/workflows/test-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -29,9 +29,7 @@ jobs:
uses: ./
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Check installed version
- name: Verify installed version
shell: pwsh
run: |
$version = & dotnet --version
Write-Host "Installed version: $version"
if (-not $version.StartsWith("${{ matrix.dotnet-version }}")) { throw "Unexpected version" }
__tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.dotnet-version }}"
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ global.json
lib/
node_modules/
__tests__/runner/*
__tests__/sample-csproj/bin/
__tests__/sample-csproj/obj/
__tests__/e2e-test-csproj/bin/
__tests__/e2e-test-csproj/obj/

# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
Expand Down
18 changes: 18 additions & 0 deletions __tests__/e2e-test-csproj/Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace test_csproj
{
[TestClass]
public class Test
{
[TestMethod]
public void TestMethod()
{
Console.WriteLine("TestMethod");
int calculatedResult = 1000 / 25;
int expectedResult = 40;
Assert.AreEqual(calculatedResult, expectedResult);
}
}
}
15 changes: 15 additions & 0 deletions __tests__/e2e-test-csproj/test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(TEST_TARGET_FRAMEWORK)</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<!-- These packages will be downloaded over the network for testing proxy settings -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170810-02" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
</ItemGroup>

</Project>
15 changes: 0 additions & 15 deletions __tests__/sample-csproj/Program.cs

This file was deleted.

18 changes: 0 additions & 18 deletions __tests__/sample-csproj/sample.csproj

This file was deleted.

Loading

0 comments on commit fc8786b

Please sign in to comment.