-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Users/ranjanar/formaster #3643
Users/ranjanar/formaster #3643
Conversation
Users/siddhap/2015vstia
Users/kavipriya/settings
VSTestPlusPlus with UI
Changes for max agents
Porting ps script execution fix
import * as ta from './testAgent'; | ||
import * as versionFinder from './versionFinder'; | ||
|
||
export class DistributedTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better naming DistributedTestExecution?
tl.debug('Configure the Agent with DTA... Invoking the createAgent REST API'); | ||
|
||
try { | ||
const agentId = await ta.TestAgent.createAgent(this.dtaTestConfig.dtaEnvironment, 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logging for agentId and process id
Tasks/VsTest/distributedtest.ts
Outdated
try { | ||
// TODO: ranjanar: fixasap : This dangerous - Note that the PID only uniquely identifies your child process | ||
// as long as it is running. After it has exited, the PID might have been reused for a different process. | ||
process.kill(this.dtaPid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verify usage of right signal event https://nodejs.org/api/process.html#process_signal_events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove TODO and check for process name before killing and to eliminate the possibility of killing some random process
Tasks/VsTest/distributedtest.ts
Outdated
// as long as it is running. After it has exited, the PID might have been reused for a different process. | ||
process.kill(this.dtaPid); | ||
} catch (error) { | ||
tl.debug('Process kill failed, pid: ' + this.dtaPid + ' , error :' + error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be Warning
Tasks/VsTest/distributedtest.ts
Outdated
} catch (error) { | ||
tl.debug('Process kill failed, pid: ' + this.dtaPid + ' , error :' + error); | ||
} | ||
tl.debug(fs.readFileSync(this.dtaTestConfig.dtaEnvironment.dtaHostLogFilePath, 'utf-8')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't look good 👎
dtaTestConfig.dtaEnvironment.dtaHost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if reading of log fails -> you shouldn't fail the task 🐛
Tasks/VsTest/distributedtest.ts
Outdated
} | ||
|
||
private async startDtaExecutionHost(agentId: any) { | ||
tl.rmRF(this.dtaTestConfig.dtaEnvironment.dtaHostLogFilePath, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prone to throw ENONET error 🐛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remind me if i miss something, why this is async?
Tasks/VsTest/distributedtest.ts
Outdated
private async startDtaExecutionHost(agentId: any) { | ||
tl.rmRF(this.dtaTestConfig.dtaEnvironment.dtaHostLogFilePath, true); | ||
const envVars: { [key: string]: string; } = process.env; | ||
utils.Helper.addToProcessEnvVars(envVars, 'DTA.AccessToken', this.dtaTestConfig.dtaEnvironment.patToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the method name justify what it's doing 😶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log what you are passing 😞
utils.Helper.addToProcessEnvVars(envVars, 'DTA.TestPlatformVersion', this.dtaTestConfig.vsTestVersion); | ||
} | ||
|
||
var exeInfo = await versionFinder.locateTestWindow(this.dtaTestConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull this up. if you can't find testWindow, don't come down 😒
utils.Helper.addToProcessEnvVars(envVars, 'runsettings', settingsFile); | ||
utils.Helper.addToProcessEnvVars(envVars, 'testdroplocation', this.dtaTestConfig.testDropLocation); | ||
utils.Helper.addToProcessEnvVars(envVars, 'testrunparams', this.dtaTestConfig.overrideTestrunParameters); | ||
utils.Helper.setEnvironmentVariableToString(envVars, 'codecoverageenabled', this.dtaTestConfig.codeCoverageEnabled); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one method doing two things. get as string and send as process variable 😞
|
||
private async cleanUp(temporarySettingsFile: string) { | ||
//cleanup the runsettings file | ||
if (temporarySettingsFile && this.dtaTestConfig.settingsFile != temporarySettingsFile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indention 👎
import tr = require('vsts-task-lib/toolrunner'); | ||
import path = require('path'); | ||
import Q = require('q'); | ||
import models = require('./models') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use tslint.json and fix simple things ';'
return obj === null || obj === '' || obj === undefined; | ||
} | ||
|
||
public static isNullOrUndefined(obj) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the use cases. aren't they all supposed to use isNullOrWhitespace
and it's very well written previously. no reinvention
|
||
public static getXmlContents(filePath: string): Q.Promise<any> { | ||
var defer=Q.defer<any>(); | ||
Helper.readFileContents(filePath, "utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helper
?
} | ||
|
||
public static getXmlContents(filePath: string): Q.Promise<any> { | ||
var defer=Q.defer<any>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indention +100
public static getXmlContents(filePath: string): Q.Promise<any> { | ||
var defer=Q.defer<any>(); | ||
Helper.readFileContents(filePath, "utf-8") | ||
.then(function (xmlContents) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it has to be async? when parseString is simple call back function. 😳
return fs.readFileSync(filePath, encoding) | ||
} | ||
|
||
public static writeXmlFile(result: any, settingsFile: string, fileExt: string): Q.Promise<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sync sync sync
return defer.promise; | ||
} | ||
|
||
public static saveToFile(fileContents: string, extension: string): Q.Promise<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saveToFile generating uuid 👎
public static getVSVersion(versionNum: number) | ||
{ | ||
switch (versionNum) { | ||
case 12: return "2013"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return type?
testDropLocation: string; // search folder | ||
overrideTestrunParameters: string; | ||
codeCoverageEnabled: boolean; | ||
videoCoverageEnabled: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it being used?
export interface DtaTestConfigurations extends TestConfigurations { | ||
onDemandTestRunId: string; | ||
testConfigurationMapping: string; // TODO : What is this? | ||
customSlicingenabled: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used?
@@ -18,6 +18,7 @@ | |||
"dependencies": { | |||
"performance-now": "0.2.0", | |||
"vsts-task-lib": "^2.0.0-preview", | |||
"vso-node-api": "6.0.4-preview", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indention
@@ -0,0 +1,45 @@ | |||
import tl = require('vsts-task-lib/task'); | |||
import models = require('./models') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix tslint issues please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do tslint fixes and squash all your commits.
Can't review/approve in this state
Please do add a tracking item for Cleanup. |
No description provided.