mirror of https://github.com/actions/toolkit
updating timer; removing logs
parent
47157e5ade
commit
d617670abc
|
@ -13,7 +13,7 @@
|
||||||
"lint": "eslint packages/**/*.ts",
|
"lint": "eslint packages/**/*.ts",
|
||||||
"lint-fix": "eslint packages/**/*.ts --fix",
|
"lint-fix": "eslint packages/**/*.ts --fix",
|
||||||
"new-package": "scripts/create-package",
|
"new-package": "scripts/create-package",
|
||||||
"test": "jest --testTimeout 70000"
|
"test": "jest --testTimeout 60000"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.4",
|
"@types/jest": "^29.5.4",
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
streamExtractExternal
|
streamExtractExternal
|
||||||
} from '../src/internal/download/download-artifact'
|
} from '../src/internal/download/download-artifact'
|
||||||
import {getUserAgentString} from '../src/internal/shared/user-agent'
|
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 * as config from '../src/internal/shared/config'
|
||||||
import {ArtifactServiceClientJSON} from '../src/generated'
|
import {ArtifactServiceClientJSON} from '../src/generated'
|
||||||
import * as util from '../src/internal/shared/util'
|
import * as util from '../src/internal/shared/util'
|
||||||
|
@ -88,7 +88,7 @@ const expectExtractedArchive = async (dir: string): Promise<void> => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const setup = async (): Promise<void> => {
|
const setup = async (): Promise<void> => {
|
||||||
//noopLogs()
|
noopLogs()
|
||||||
await fs.promises.mkdir(testDir, {recursive: true})
|
await fs.promises.mkdir(testDir, {recursive: true})
|
||||||
await createTestArchive()
|
await createTestArchive()
|
||||||
|
|
||||||
|
@ -251,7 +251,6 @@ describe('download-artifact', () => {
|
||||||
|
|
||||||
it('should fail if blob storage storage chunk does not respond within 30s', async () => {
|
it('should fail if blob storage storage chunk does not respond within 30s', async () => {
|
||||||
// mock http client to delay response data by 30s
|
// mock http client to delay response data by 30s
|
||||||
//
|
|
||||||
const msg = new http.IncomingMessage(new net.Socket())
|
const msg = new http.IncomingMessage(new net.Socket())
|
||||||
msg.statusCode = 200
|
msg.statusCode = 200
|
||||||
|
|
||||||
|
@ -285,7 +284,7 @@ describe('download-artifact', () => {
|
||||||
).rejects.toBeInstanceOf(Error)
|
).rejects.toBeInstanceOf(Error)
|
||||||
|
|
||||||
expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString())
|
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 () => {
|
it('should fail if blob storage response is non-200 after 5 retries', async () => {
|
||||||
const downloadArtifactMock = github.getOctokit(fixtures.token).rest
|
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> {
|
async function streamExtract(url: string, directory: string): Promise<void> {
|
||||||
core.info(`Stream extract started`)
|
|
||||||
let retryCount = 0
|
let retryCount = 0
|
||||||
while (retryCount < 5) {
|
while (retryCount < 5) {
|
||||||
try {
|
try {
|
||||||
|
@ -66,7 +65,6 @@ export async function streamExtractExternal(
|
||||||
|
|
||||||
const client = new httpClient.HttpClient(getUserAgentString())
|
const client = new httpClient.HttpClient(getUserAgentString())
|
||||||
const response = await client.get(url)
|
const response = await client.get(url)
|
||||||
core.info(`Stream extract internal get called`)
|
|
||||||
|
|
||||||
if (response.message.statusCode !== 200) {
|
if (response.message.statusCode !== 200) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -78,8 +76,6 @@ export async function streamExtractExternal(
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timerFn = (): void => {
|
const timerFn = (): void => {
|
||||||
// close response stream
|
|
||||||
core.warning('timerFn: closing response stream')
|
|
||||||
response.message.destroy(
|
response.message.destroy(
|
||||||
new Error(`Blob storage chunk did not respond in ${timeout}ms`)
|
new Error(`Blob storage chunk did not respond in ${timeout}ms`)
|
||||||
)
|
)
|
||||||
|
@ -91,7 +87,7 @@ export async function streamExtractExternal(
|
||||||
timer.refresh()
|
timer.refresh()
|
||||||
})
|
})
|
||||||
.on('error', (error: Error) => {
|
.on('error', (error: Error) => {
|
||||||
core.warning(
|
core.debug(
|
||||||
`response.message: Artifact download failed: ${error.message}`
|
`response.message: Artifact download failed: ${error.message}`
|
||||||
)
|
)
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
|
|
Loading…
Reference in New Issue