-
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.
Merge branch 'master' into users/ansheno/aaAgentless
- Loading branch information
Showing
40 changed files
with
513 additions
and
129 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import ma = require('azure-pipelines-task-lib/mock-answer'); | ||
import tmrm = require('azure-pipelines-task-lib/mock-run'); | ||
import path = require('path'); | ||
|
||
let taskPath = path.join(__dirname, '..', 'bash.js'); | ||
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); | ||
|
||
tmr.setInput('targetType', 'inline'); | ||
tmr.setInput('workingDirectory', '/fakecwd'); | ||
tmr.setInput('script', `>&2 echo "myErrorTest"`); | ||
tmr.setInput('failOnStderr', 'true'); | ||
|
||
//Create assertAgent and getVariable mocks, support not added in this version of task-lib | ||
const tl = require('azure-pipelines-task-lib/mock-task'); | ||
const tlClone = Object.assign({}, tl); | ||
tlClone.getVariable = function(variable: string) { | ||
if (variable.toLowerCase() == 'agent.tempdirectory') { | ||
return 'temp/path'; | ||
} | ||
return null; | ||
}; | ||
tlClone.assertAgent = function(variable: string) { | ||
return; | ||
}; | ||
tmr.registerMock('azure-pipelines-task-lib/mock-task', tlClone); | ||
|
||
// Mock task-lib | ||
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{ | ||
'checkPath' : { | ||
'/fakecwd' : true, | ||
'path/to/bash': true, | ||
'temp/path': true | ||
}, | ||
'which': { | ||
'bash': 'path/to/bash' | ||
}, | ||
'assertAgent': { | ||
'2.115.0': true | ||
}, | ||
'exec': { | ||
'path/to/bash --noprofile --norc -c pwd': { | ||
"code": 0, | ||
"stdout": "temp/path" | ||
}, | ||
'path/to/bash temp/path/fileName.sh': { | ||
"code": 0, | ||
"stdout": "", | ||
"stderr": "myErrorTest" | ||
} | ||
} | ||
}; | ||
tmr.setAnswers(a); | ||
|
||
// Mock fs | ||
const fs = require('fs'); | ||
const fsClone = Object.assign({}, fs); | ||
fsClone.writeFileSync = function(filePath, contents, options) { | ||
console.log(`Writing ${contents} to ${filePath}`); | ||
} | ||
tmr.registerMock('fs', fsClone); | ||
|
||
// Mock uuidv4 | ||
tmr.registerMock('uuid/v4', function () { | ||
return 'fileName'; | ||
}); | ||
|
||
tmr.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
Oops, something went wrong.