mirror of
				https://github.com/actions/setup-dotnet.git
				synced 2025-10-31 23:43:44 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									0f534f5829
								
							
						
					
					
						commit
						5fdecd2063
					
				| @ -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'; | ||||||
| 
 | 
 | ||||||
| describe('Dotnet installation scripts tests', () => { | const HTTP_CLIENT_OPTIONS = {allowRetries: true, maxRetries: 10} as const; | ||||||
|   it('Uses an up to date bash download script', async () => { | const TEST_TIMEOUT = 30000; | ||||||
|     const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], { |  | ||||||
|       allowRetries: true, |  | ||||||
|       maxRetries: 3 |  | ||||||
|     }); |  | ||||||
|     const response: hc.HttpClientResponse = await httpCallbackClient.get( |  | ||||||
|       'https://dot.net/v1/dotnet-install.sh' |  | ||||||
|     ); |  | ||||||
|     expect(response.message.statusCode).toBe(200); |  | ||||||
|     const upToDateContents: string = await response.readBody(); |  | ||||||
|     const currentContents: string = fs |  | ||||||
|       .readFileSync( |  | ||||||
|         path.join(__dirname, '..', 'externals', 'install-dotnet.sh') |  | ||||||
|       ) |  | ||||||
|       .toString(); |  | ||||||
|     expect(normalizeFileContents(currentContents)).toBe( |  | ||||||
|       normalizeFileContents(upToDateContents) |  | ||||||
|     ); |  | ||||||
|   }, 30000); |  | ||||||
| 
 | 
 | ||||||
|   it('Uses an up to date powershell download script', async () => { | describe('Dotnet installation scripts tests', () => { | ||||||
|     const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], { |   it( | ||||||
|       allowRetries: true, |     'Uses an up to date bash download script', | ||||||
|       maxRetries: 3 |     async () => { | ||||||
|     }); |       const httpCallbackClient = new hc.HttpClient( | ||||||
|     const response: hc.HttpClientResponse = await httpCallbackClient.get( |         'setup-dotnet-test', | ||||||
|       'https://dot.net/v1/dotnet-install.ps1' |         [], | ||||||
|     ); |         HTTP_CLIENT_OPTIONS | ||||||
|     expect(response.message.statusCode).toBe(200); |       ); | ||||||
|     const upToDateContents: string = await response.readBody(); |       const response: hc.HttpClientResponse = await httpCallbackClient.get( | ||||||
|     const currentContents: string = fs |         'https://dot.net/v1/dotnet-install.sh' | ||||||
|       .readFileSync( |       ); | ||||||
|         path.join(__dirname, '..', 'externals', 'install-dotnet.ps1') |       expect(response.message.statusCode).toBe(200); | ||||||
|       ) |       const upToDateContents: string = await response.readBody(); | ||||||
|       .toString(); |       const currentContents: string = fs | ||||||
|     expect(normalizeFileContents(currentContents)).toBe( |         .readFileSync( | ||||||
|       normalizeFileContents(upToDateContents) |           path.join(__dirname, '..', 'externals', 'install-dotnet.sh') | ||||||
|     ); |         ) | ||||||
|   }, 30000); |         .toString(); | ||||||
|  |       expect(normalizeFileContents(currentContents)).toBe( | ||||||
|  |         normalizeFileContents(upToDateContents) | ||||||
|  |       ); | ||||||
|  |     }, | ||||||
|  |     TEST_TIMEOUT | ||||||
|  |   ); | ||||||
|  | 
 | ||||||
|  |   it( | ||||||
|  |     'Uses an up to date powershell download script', | ||||||
|  |     async () => { | ||||||
|  |       const httpCallbackClient = new hc.HttpClient( | ||||||
|  |         'setup-dotnet-test', | ||||||
|  |         [], | ||||||
|  |         HTTP_CLIENT_OPTIONS | ||||||
|  |       ); | ||||||
|  |       const response: hc.HttpClientResponse = await httpCallbackClient.get( | ||||||
|  |         'https://dot.net/v1/dotnet-install.ps1' | ||||||
|  |       ); | ||||||
|  |       expect(response.message.statusCode).toBe(200); | ||||||
|  |       const upToDateContents: string = await response.readBody(); | ||||||
|  |       const currentContents: string = fs | ||||||
|  |         .readFileSync( | ||||||
|  |           path.join(__dirname, '..', 'externals', 'install-dotnet.ps1') | ||||||
|  |         ) | ||||||
|  |         .toString(); | ||||||
|  |       expect(normalizeFileContents(currentContents)).toBe( | ||||||
|  |         normalizeFileContents(upToDateContents) | ||||||
|  |       ); | ||||||
|  |     }, | ||||||
|  |     TEST_TIMEOUT | ||||||
|  |   ); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| function normalizeFileContents(contents: string): string { | function normalizeFileContents(contents: string): string { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user