-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cherrypick] DownloadPackageV1 - Fix successful result status on down…
…load failure (#14568) * Handle the case of pkg download error in DownloadPackageV1 task. * Remove only token variable for DownloadPackageV1 tests. * Bump patch version.
- Loading branch information
Showing
12 changed files
with
75 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Tasks/DownloadPackageV1/Tests/L0DownloadNpmPackageDownloadError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import tmrm = require("azure-pipelines-task-lib/mock-run"); | ||
import path = require("path"); | ||
import { WebApiMock } from "./helpers/webapimock"; | ||
|
||
let taskPath = path.join(__dirname, "..", "main.js"); | ||
let outputPath: string = path.join(__dirname, "out", "packageOutput"); | ||
let tempPath: string = path.join(__dirname, "temp"); | ||
let zipLocation: string = path.join(tempPath, "singlePackageName.tgz"); | ||
let tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); | ||
|
||
// Set inputs | ||
tr.setInput("packageType", "npm"); | ||
tr.setInput("feed", "feedId"); | ||
tr.setInput("view", "viewId"); | ||
tr.setInput("definition", "6f598cbe-a5e2-4f75-aa78-e0fd08301a15"); | ||
tr.setInput("version", "versionId"); | ||
tr.setInput("downloadPath", outputPath); | ||
tr.setInput("extract", "true"); | ||
tr.setInput("verbosity", "verbose"); | ||
|
||
// Set variables. | ||
process.env["AGENT_TEMPDIRECTORY"] = tempPath; | ||
process.env["SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"] = "https://abc.visualstudio.com/"; | ||
process.env["AGENT_VERSION"] = "2.116.0"; | ||
process.env["HOME"] = "/users/test"; | ||
|
||
// provide answers for task mock | ||
tr.setAnswers({ | ||
exist: { | ||
[outputPath]: true, | ||
[tempPath]: true | ||
}, | ||
rmRF: { | ||
[zipLocation]: { | ||
success: true | ||
} | ||
} | ||
}); | ||
|
||
// Register connections mock | ||
tr.registerMock("./connections", { | ||
getConnection: function(): Promise<any> { | ||
return Promise.resolve(new WebApiMock()); | ||
} | ||
}); | ||
|
||
tr.registerMock("./package", { | ||
download: async function(): Promise<any> { | ||
throw "download error"; | ||
} | ||
}) | ||
|
||
|
||
tr.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters