Increase amount of retries for Dotnet installation scripts tests (#427)

* Increase amount of retries for Dotnet installation scripts tests

* Format: Increase amount of retries for Dotnet installation scripts tests
This commit is contained in:
Nikolai Laevskii 2023-05-19 08:50:54 +02:00 committed by GitHub
parent 0f534f5829
commit 5fdecd2063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 52 additions and 39 deletions

View File

@ -2,12 +2,18 @@ import path from 'path';
import fs from 'fs'; import fs from 'fs';
import * as hc from '@actions/http-client'; import * as hc from '@actions/http-client';
const HTTP_CLIENT_OPTIONS = {allowRetries: true, maxRetries: 10} as const;
const TEST_TIMEOUT = 30000;
describe('Dotnet installation scripts tests', () => { describe('Dotnet installation scripts tests', () => {
it('Uses an up to date bash download script', async () => { it(
const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], { 'Uses an up to date bash download script',
allowRetries: true, async () => {
maxRetries: 3 const httpCallbackClient = new hc.HttpClient(
}); 'setup-dotnet-test',
[],
HTTP_CLIENT_OPTIONS
);
const response: hc.HttpClientResponse = await httpCallbackClient.get( const response: hc.HttpClientResponse = await httpCallbackClient.get(
'https://dot.net/v1/dotnet-install.sh' 'https://dot.net/v1/dotnet-install.sh'
); );
@ -21,13 +27,18 @@ describe('Dotnet installation scripts tests', () => {
expect(normalizeFileContents(currentContents)).toBe( expect(normalizeFileContents(currentContents)).toBe(
normalizeFileContents(upToDateContents) normalizeFileContents(upToDateContents)
); );
}, 30000); },
TEST_TIMEOUT
);
it('Uses an up to date powershell download script', async () => { it(
const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], { 'Uses an up to date powershell download script',
allowRetries: true, async () => {
maxRetries: 3 const httpCallbackClient = new hc.HttpClient(
}); 'setup-dotnet-test',
[],
HTTP_CLIENT_OPTIONS
);
const response: hc.HttpClientResponse = await httpCallbackClient.get( const response: hc.HttpClientResponse = await httpCallbackClient.get(
'https://dot.net/v1/dotnet-install.ps1' 'https://dot.net/v1/dotnet-install.ps1'
); );
@ -41,7 +52,9 @@ describe('Dotnet installation scripts tests', () => {
expect(normalizeFileContents(currentContents)).toBe( expect(normalizeFileContents(currentContents)).toBe(
normalizeFileContents(upToDateContents) normalizeFileContents(upToDateContents)
); );
}, 30000); },
TEST_TIMEOUT
);
}); });
function normalizeFileContents(contents: string): string { function normalizeFileContents(contents: string): string {