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
pull/428/head^2
Nikolai Laevskii 3 years ago committed by GitHub
parent 0f534f5829
commit 5fdecd2063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,46 +2,59 @@ 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',
const response: hc.HttpClientResponse = await httpCallbackClient.get( [],
'https://dot.net/v1/dotnet-install.sh' HTTP_CLIENT_OPTIONS
); );
expect(response.message.statusCode).toBe(200); const response: hc.HttpClientResponse = await httpCallbackClient.get(
const upToDateContents: string = await response.readBody(); 'https://dot.net/v1/dotnet-install.sh'
const currentContents: string = fs );
.readFileSync( expect(response.message.statusCode).toBe(200);
path.join(__dirname, '..', 'externals', 'install-dotnet.sh') const upToDateContents: string = await response.readBody();
) const currentContents: string = fs
.toString(); .readFileSync(
expect(normalizeFileContents(currentContents)).toBe( path.join(__dirname, '..', 'externals', 'install-dotnet.sh')
normalizeFileContents(upToDateContents) )
); .toString();
}, 30000); expect(normalizeFileContents(currentContents)).toBe(
normalizeFileContents(upToDateContents)
);
},
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',
const response: hc.HttpClientResponse = await httpCallbackClient.get( [],
'https://dot.net/v1/dotnet-install.ps1' HTTP_CLIENT_OPTIONS
); );
expect(response.message.statusCode).toBe(200); const response: hc.HttpClientResponse = await httpCallbackClient.get(
const upToDateContents: string = await response.readBody(); 'https://dot.net/v1/dotnet-install.ps1'
const currentContents: string = fs );
.readFileSync( expect(response.message.statusCode).toBe(200);
path.join(__dirname, '..', 'externals', 'install-dotnet.ps1') const upToDateContents: string = await response.readBody();
) const currentContents: string = fs
.toString(); .readFileSync(
expect(normalizeFileContents(currentContents)).toBe( path.join(__dirname, '..', 'externals', 'install-dotnet.ps1')
normalizeFileContents(upToDateContents) )
); .toString();
}, 30000); expect(normalizeFileContents(currentContents)).toBe(
normalizeFileContents(upToDateContents)
);
},
TEST_TIMEOUT
);
}); });
function normalizeFileContents(contents: string): string { function normalizeFileContents(contents: string): string {

Loading…
Cancel
Save