mirror of https://github.com/actions/toolkit
updating timer; removing logs
parent
47157e5ade
commit
d617670abc
|
@ -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",
|
||||
|
|
|
@ -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<void> => {
|
|||
}
|
||||
|
||||
const setup = async (): Promise<void> => {
|
||||
//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
|
||||
|
|
|
@ -38,7 +38,6 @@ async function exists(path: string): Promise<boolean> {
|
|||
}
|
||||
|
||||
async function streamExtract(url: string, directory: string): Promise<void> {
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue