mirror of
https://github.com/actions/setup-dotnet.git
synced 2026-01-15 03:20:53 +08:00
Bump test dependencies to resolve System.Net.Http vulnerability, update workflows and README (#692)
* update test deps, workflows, and docs for latest versions * fix wording * update versions
This commit is contained in:
4
__tests__/e2e-test-csproj/AssemblyInfo.cs
Normal file
4
__tests__/e2e-test-csproj/AssemblyInfo.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
// Sequential test execution
|
||||
[assembly: DoNotParallelize]
|
||||
@@ -12,7 +12,7 @@ namespace test_csproj
|
||||
Console.WriteLine("TestMethod");
|
||||
int calculatedResult = 1000 / 25;
|
||||
int expectedResult = 40;
|
||||
Assert.AreEqual(calculatedResult, expectedResult);
|
||||
Assert.AreEqual(expectedResult, calculatedResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,9 +8,9 @@
|
||||
|
||||
<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" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="4.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="4.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('installer tests', () => {
|
||||
});
|
||||
|
||||
it('should throw the error in case of non-zero exit code of the installation script. The error message should contain logs.', async () => {
|
||||
const inputVersion = '3.1.100';
|
||||
const inputVersion = '10.0.101';
|
||||
const inputQuality = '' as QualityOptions;
|
||||
const errorMessage = 'fictitious error message!';
|
||||
|
||||
@@ -60,7 +60,7 @@ describe('installer tests', () => {
|
||||
});
|
||||
|
||||
it('should return version of .NET SDK after installation complete', async () => {
|
||||
const inputVersion = '3.1.100';
|
||||
const inputVersion = '10.0.101';
|
||||
const inputQuality = '' as QualityOptions;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
getExecOutputSpy.mockImplementation(() => {
|
||||
@@ -82,7 +82,7 @@ describe('installer tests', () => {
|
||||
});
|
||||
|
||||
it(`should supply 'version' argument to the installation script if supplied version is in A.B.C syntax`, async () => {
|
||||
const inputVersion = '6.0.300';
|
||||
const inputVersion = '10.0.101';
|
||||
const inputQuality = '' as QualityOptions;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
|
||||
@@ -120,7 +120,7 @@ describe('installer tests', () => {
|
||||
});
|
||||
|
||||
it(`should warn if the 'quality' input is set and the supplied version is in A.B.C syntax`, async () => {
|
||||
const inputVersion = '6.0.300';
|
||||
const inputVersion = '10.0.101';
|
||||
const inputQuality = 'ga' as QualityOptions;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
getExecOutputSpy.mockImplementation(() => {
|
||||
@@ -147,7 +147,7 @@ describe('installer tests', () => {
|
||||
it(`should warn if the 'quality' input is set and version isn't in A.B.C syntax but major tag is lower then 6`, async () => {
|
||||
const inputVersion = '3.1';
|
||||
const inputQuality = 'ga' as QualityOptions;
|
||||
const stdout = `Fictitious dotnet version 3.1.100 is installed`;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
|
||||
getExecOutputSpy.mockImplementation(() => {
|
||||
return Promise.resolve({
|
||||
@@ -170,12 +170,12 @@ describe('installer tests', () => {
|
||||
);
|
||||
});
|
||||
|
||||
each(['6', '6.0', '6.0.x', '6.0.*', '6.0.X']).test(
|
||||
each(['10', '10.0', '10.0.x', '10.0.*', '10.0.X']).test(
|
||||
`should supply 'quality' argument to the installation script if quality input is set and version (%s) is not in A.B.C syntax`,
|
||||
async inputVersion => {
|
||||
const inputQuality = 'ga' as QualityOptions;
|
||||
const exitCode = 0;
|
||||
const stdout = `Fictitious dotnet version 6.0.0 is installed`;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
getExecOutputSpy.mockImplementation(() => {
|
||||
return Promise.resolve({
|
||||
exitCode: exitCode,
|
||||
@@ -210,12 +210,12 @@ describe('installer tests', () => {
|
||||
}
|
||||
);
|
||||
|
||||
each(['6', '6.0', '6.0.x', '6.0.*', '6.0.X']).test(
|
||||
each(['10', '10.0', '10.0.x', '10.0.*', '10.0.X']).test(
|
||||
`should supply 'channel' argument to the installation script if version (%s) isn't in A.B.C syntax`,
|
||||
async inputVersion => {
|
||||
const inputQuality = '' as QualityOptions;
|
||||
const exitCode = 0;
|
||||
const stdout = `Fictitious dotnet version 6.0.0 is installed`;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
getExecOutputSpy.mockImplementation(() => {
|
||||
return Promise.resolve({
|
||||
exitCode: exitCode,
|
||||
@@ -243,8 +243,8 @@ describe('installer tests', () => {
|
||||
getExecOutputSpy.mock.calls[callIndex][1] as string[]
|
||||
).join(' ');
|
||||
const expectedArgument = IS_WINDOWS
|
||||
? `-Channel 6.0`
|
||||
: `--channel 6.0`;
|
||||
? `-Channel 10.0`
|
||||
: `--channel 10.0`;
|
||||
|
||||
expect(scriptArguments).toContain(expectedArgument);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ describe('installer tests', () => {
|
||||
if (IS_WINDOWS) {
|
||||
it(`should supply '-ProxyAddress' argument to the installation script if env.variable 'https_proxy' is set`, async () => {
|
||||
process.env['https_proxy'] = 'https://proxy.com';
|
||||
const inputVersion = '6.0.100';
|
||||
const inputVersion = '10.0.101';
|
||||
const inputQuality = '' as QualityOptions;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
|
||||
@@ -291,9 +291,9 @@ describe('installer tests', () => {
|
||||
|
||||
it(`should supply '-ProxyBypassList' argument to the installation script if env.variable 'no_proxy' is set`, async () => {
|
||||
process.env['no_proxy'] = 'first.url,second.url';
|
||||
const inputVersion = '6.0.100';
|
||||
const inputVersion = '10.0.101';
|
||||
const inputQuality = '' as QualityOptions;
|
||||
const stdout = `Fictitious dotnet version 6.0.0 is installed`;
|
||||
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
|
||||
|
||||
getExecOutputSpy.mockImplementation(() => {
|
||||
return Promise.resolve({
|
||||
@@ -349,14 +349,14 @@ describe('installer tests', () => {
|
||||
describe('DotnetVersionResolver tests', () => {
|
||||
describe('createDotnetVersion() tests', () => {
|
||||
each([
|
||||
'3.1',
|
||||
'3.x',
|
||||
'3.1.x',
|
||||
'3.1.*',
|
||||
'3.1.X',
|
||||
'3.1.2',
|
||||
'3.1.0-preview1',
|
||||
'6.0.2xx'
|
||||
'10.0',
|
||||
'10.x',
|
||||
'10.0.x',
|
||||
'10.0.*',
|
||||
'10.0.X',
|
||||
'10.0.0',
|
||||
'10.0.0-preview7',
|
||||
'10.0.1xx'
|
||||
]).test(
|
||||
'if valid version is supplied (%s), it should return version object with some value',
|
||||
async version => {
|
||||
@@ -408,7 +408,7 @@ describe('installer tests', () => {
|
||||
}
|
||||
);
|
||||
|
||||
each(['3', '3.1', '3.1.x', '3.1.*', '3.1.X', '6.0.2xx']).test(
|
||||
each(['10', '10.0', '10.0.x', '10.0.*', '10.0.X', '10.0.1xx']).test(
|
||||
"if version that can be resolved to 'channel' option is supplied (%s), it should set type to 'channel' in version object",
|
||||
async version => {
|
||||
const dotnetVersionResolver = new installer.DotnetVersionResolver(
|
||||
@@ -423,7 +423,7 @@ describe('installer tests', () => {
|
||||
}
|
||||
);
|
||||
|
||||
each(['6.0', '6.0.x', '6.0.*', '6.0.X', '6.0.2xx']).test(
|
||||
each(['10.0', '10.0.x', '10.0.*', '10.0.X', '10.0.1xx']).test(
|
||||
"if version that can be resolved to 'channel' option is supplied and its major tag is >= 6 (%s), it should set type to 'channel' and qualityFlag to 'true' in version object",
|
||||
async version => {
|
||||
const dotnetVersionResolver = new installer.DotnetVersionResolver(
|
||||
@@ -439,7 +439,7 @@ describe('installer tests', () => {
|
||||
}
|
||||
);
|
||||
|
||||
each(['3.1.2', '3.1.0-preview1']).test(
|
||||
each(['10.0.0', '10.0.0-preview7']).test(
|
||||
"if version that can be resolved to 'version' option is supplied (%s), it should set quality flag to 'false' and type to 'version' in version object",
|
||||
async version => {
|
||||
const dotnetVersionResolver = new installer.DotnetVersionResolver(
|
||||
@@ -455,7 +455,7 @@ describe('installer tests', () => {
|
||||
}
|
||||
);
|
||||
|
||||
each(['3.1.2', '3.1']).test(
|
||||
each(['10.0.0', '10.0']).test(
|
||||
'it should create proper line arguments for powershell/bash installation scripts',
|
||||
async version => {
|
||||
const dotnetVersionResolver = new installer.DotnetVersionResolver(
|
||||
|
||||
@@ -81,7 +81,7 @@ describe('setup-dotnet tests', () => {
|
||||
|
||||
it('should fail the action if quality is supplied but its value is not supported', async () => {
|
||||
inputs['global-json-file'] = '';
|
||||
inputs['dotnet-version'] = ['6.0'];
|
||||
inputs['dotnet-version'] = ['10.0'];
|
||||
inputs['dotnet-quality'] = 'fictitiousQuality';
|
||||
|
||||
const expectedErrorMessage = `Value '${inputs['dotnet-quality']}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`;
|
||||
@@ -92,7 +92,7 @@ describe('setup-dotnet tests', () => {
|
||||
|
||||
it('should call installDotnet() multiple times if dotnet-version multiline input is provided', async () => {
|
||||
inputs['global-json-file'] = '';
|
||||
inputs['dotnet-version'] = ['6.0', '7.0'];
|
||||
inputs['dotnet-version'] = ['9.0', '10.0'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(''));
|
||||
@@ -103,7 +103,7 @@ describe('setup-dotnet tests', () => {
|
||||
|
||||
it('should call addToPath() after installation complete', async () => {
|
||||
inputs['global-json-file'] = '';
|
||||
inputs['dotnet-version'] = ['6.0', '7.0'];
|
||||
inputs['dotnet-version'] = ['9.0', '10.0'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(''));
|
||||
@@ -145,7 +145,7 @@ describe('setup-dotnet tests', () => {
|
||||
});
|
||||
|
||||
it('should call setOutput() after installation complete successfully', async () => {
|
||||
inputs['dotnet-version'] = ['6.0.300'];
|
||||
inputs['dotnet-version'] = ['10.0.101'];
|
||||
|
||||
installDotnetSpy.mockImplementation(() =>
|
||||
Promise.resolve(`${inputs['dotnet-version']}`)
|
||||
@@ -156,7 +156,7 @@ describe('setup-dotnet tests', () => {
|
||||
});
|
||||
|
||||
it(`shouldn't call setOutput() if parsing dotnet-installer logs failed`, async () => {
|
||||
inputs['dotnet-version'] = ['6.0.300'];
|
||||
inputs['dotnet-version'] = ['10.0.101'];
|
||||
const warningMessage = `Failed to output the installed version of .NET. The 'dotnet-version' output will not be set.`;
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(null));
|
||||
@@ -177,7 +177,7 @@ describe('setup-dotnet tests', () => {
|
||||
});
|
||||
|
||||
it(`should get 'cache-dependency-path' and call restoreCache() if input cache is set to true and cache feature is available`, async () => {
|
||||
inputs['dotnet-version'] = ['6.0.300'];
|
||||
inputs['dotnet-version'] = ['10.0.101'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['cache'] = true;
|
||||
inputs['cache-dependency-path'] = 'fictitious.package.lock.json';
|
||||
@@ -195,7 +195,7 @@ describe('setup-dotnet tests', () => {
|
||||
});
|
||||
|
||||
it(`shouldn't call restoreCache() if input cache isn't set to true`, async () => {
|
||||
inputs['dotnet-version'] = ['6.0.300'];
|
||||
inputs['dotnet-version'] = ['10.0.101'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['cache'] = false;
|
||||
|
||||
@@ -209,7 +209,7 @@ describe('setup-dotnet tests', () => {
|
||||
});
|
||||
|
||||
it(`shouldn't call restoreCache() if cache feature isn't available`, async () => {
|
||||
inputs['dotnet-version'] = ['6.0.300'];
|
||||
inputs['dotnet-version'] = ['10.0.101'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['cache'] = true;
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ $targetFrameworkVersionMap = @{
|
||||
"7.0" = "net7.0";
|
||||
"8.0" = "net8.0";
|
||||
"9.0" = "net9.0";
|
||||
"10.0" = "net10.0";
|
||||
}
|
||||
|
||||
foreach ($version in $Versions)
|
||||
|
||||
Reference in New Issue
Block a user