Skip to content
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

Merged
merged 71 commits into from
Feb 20, 2017
Merged

Users/ranjanar/formaster #3643

merged 71 commits into from
Feb 20, 2017

Conversation

RanjanarMS
Copy link
Member

No description provided.

import * as ta from './testAgent';
import * as versionFinder from './versionFinder';

export class DistributedTest {
Copy link

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);
Copy link

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

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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

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

// 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);
Copy link

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

} catch (error) {
tl.debug('Process kill failed, pid: ' + this.dtaPid + ' , error :' + error);
}
tl.debug(fs.readFileSync(this.dtaTestConfig.dtaEnvironment.dtaHostLogFilePath, 'utf-8'));
Copy link

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

Copy link

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 🐛

}

private async startDtaExecutionHost(agentId: any) {
tl.rmRF(this.dtaTestConfig.dtaEnvironment.dtaHostLogFilePath, true);
Copy link

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 🐛

Copy link

@nigurr nigurr Feb 17, 2017

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?

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);
Copy link

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 😶

Copy link

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);
Copy link

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);
Copy link

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) {
Copy link

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')
Copy link

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) {
Copy link

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")
Copy link

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>();
Copy link

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) {
Copy link

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> {
Copy link

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> {
Copy link

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";
Copy link

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;
Copy link

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;
Copy link

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",
Copy link

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')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix tslint issues please

Copy link

@nigurr nigurr left a 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

@nigurr
Copy link

nigurr commented Feb 20, 2017

Please do add a tracking item for Cleanup.

@RanjanarMS RanjanarMS merged commit 7b2160b into master Feb 20, 2017
@RanjanarMS RanjanarMS deleted the users/ranjanar/formaster branch March 6, 2017 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants