From d617670abc8cc06c5f6fd82c9f927d6198ded0d4 Mon Sep 17 00:00:00 2001 From: Vallie Joseph Date: Tue, 9 Jan 2024 19:23:57 +0000 Subject: [PATCH] updating timer; removing logs --- package.json | 2 +- packages/artifact/__tests__/download-artifact.test.ts | 7 +++---- .../artifact/src/internal/download/download-artifact.ts | 6 +----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 886033c3..ea3ac2ed 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "lint": "eslint packages/**/*.ts", "lint-fix": "eslint packages/**/*.ts --fix", "new-package": "scripts/create-package", - "test": "jest --testTimeout 70000" + "test": "jest --testTimeout 60000" }, "devDependencies": { "@types/jest": "^29.5.4", diff --git a/packages/artifact/__tests__/download-artifact.test.ts b/packages/artifact/__tests__/download-artifact.test.ts index cd1896aa..1c0c9b0d 100644 --- a/packages/artifact/__tests__/download-artifact.test.ts +++ b/packages/artifact/__tests__/download-artifact.test.ts @@ -13,7 +13,7 @@ import { streamExtractExternal } from '../src/internal/download/download-artifact' import {getUserAgentString} from '../src/internal/shared/user-agent' -//import {noopLogs} from './common' +import {noopLogs} from './common' import * as config from '../src/internal/shared/config' import {ArtifactServiceClientJSON} from '../src/generated' import * as util from '../src/internal/shared/util' @@ -88,7 +88,7 @@ const expectExtractedArchive = async (dir: string): Promise => { } const setup = async (): Promise => { - //noopLogs() + noopLogs() await fs.promises.mkdir(testDir, {recursive: true}) await createTestArchive() @@ -251,7 +251,6 @@ describe('download-artifact', () => { it('should fail if blob storage storage chunk does not respond within 30s', async () => { // mock http client to delay response data by 30s - // const msg = new http.IncomingMessage(new net.Socket()) msg.statusCode = 200 @@ -285,7 +284,7 @@ describe('download-artifact', () => { ).rejects.toBeInstanceOf(Error) expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString()) - }, 35000) + }, 35000) // add longer timeout to allow for timer to run out it('should fail if blob storage response is non-200 after 5 retries', async () => { const downloadArtifactMock = github.getOctokit(fixtures.token).rest diff --git a/packages/artifact/src/internal/download/download-artifact.ts b/packages/artifact/src/internal/download/download-artifact.ts index 42dfa1cf..21a1bdb1 100644 --- a/packages/artifact/src/internal/download/download-artifact.ts +++ b/packages/artifact/src/internal/download/download-artifact.ts @@ -38,7 +38,6 @@ async function exists(path: string): Promise { } async function streamExtract(url: string, directory: string): Promise { - core.info(`Stream extract started`) let retryCount = 0 while (retryCount < 5) { try { @@ -66,7 +65,6 @@ export async function streamExtractExternal( const client = new httpClient.HttpClient(getUserAgentString()) const response = await client.get(url) - core.info(`Stream extract internal get called`) if (response.message.statusCode !== 200) { throw new Error( @@ -78,8 +76,6 @@ export async function streamExtractExternal( return new Promise((resolve, reject) => { const timerFn = (): void => { - // close response stream - core.warning('timerFn: closing response stream') response.message.destroy( new Error(`Blob storage chunk did not respond in ${timeout}ms`) ) @@ -91,7 +87,7 @@ export async function streamExtractExternal( timer.refresh() }) .on('error', (error: Error) => { - core.warning( + core.debug( `response.message: Artifact download failed: ${error.message}` ) clearTimeout(timer)