Skip to content

Commit fc85559

Browse files
committed
Resolve comment and remove local spawning code
1 parent defe5f8 commit fc85559

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

bin/commands/runs.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,29 @@ module.exports = function run(args, rawArgs) {
149149
}
150150

151151
if (turboScaleSession) {
152+
// Local is only required in case user is running on trial grid and wants to access private website.
153+
// Even then, it will be spawned separately via browserstack-cli ats connect-grid command and not via browserstack-cypress-cli
154+
// Hence whenever running on ATS, need to make local as false
155+
bsConfig.connection_settings.local = false;
156+
152157
const gridDetails = await getTurboScaleGridDetails(bsConfig);
153-
Constants.turboScaleObj.gridDetails = gridDetails;
154158

155-
if (gridDetails.isTrialGrid) {
156-
bsConfig.connection_settings.local = true;
157-
bsConfig.connection_settings.local_inferred = true;
158-
bsConfig.connection_settings.local_mode = 'on-demand';
159-
}
159+
if (gridDetails && Object.keys(gridDetails).length > 0) {
160+
Constants.turboScaleObj.gridDetails = gridDetails;
161+
162+
if (gridDetails.isTrialGrid) {
163+
logger.info('Will be running the build on Trial Grid. Ensure you are using connect-grid command if using a private website');
164+
}
160165

161-
Constants.turboScaleObj.gridUrl = gridDetails.cypressUrl;
162-
Constants.turboScaleObj.uploadUrl = gridDetails.cypressUrl + '/upload';
163-
Constants.turboScaleObj.buildUrl = gridDetails.cypressUrl + '/build';
166+
Constants.turboScaleObj.gridUrl = gridDetails.cypressUrl;
167+
Constants.turboScaleObj.uploadUrl = gridDetails.cypressUrl + '/upload';
168+
Constants.turboScaleObj.buildUrl = gridDetails.cypressUrl + '/build';
164169

165-
logger.debug(`Automate TurboScale Grid URL set to ${gridDetails.url}`);
170+
logger.debug(`Automate TurboScale Grid URL set to ${gridDetails.url}`);
171+
} else {
172+
process.exitCode = Constants.ERROR_EXIT_CODE;
173+
return;
174+
}
166175
}
167176
}
168177

bin/helpers/atsHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ exports.getTurboScaleGridDetails = async (bsConfig) => {
6666
responseData = {};
6767
}
6868
if(resp.statusCode != 200) {
69-
logger.warn(`Warn: Get Initial Details Request failed with status code ${resp.statusCode}`);
69+
logger.warn(`Warn: Get Automate TurboScale Details Request failed with status code ${resp.statusCode}`);
7070
utils.sendUsageReport(bsConfig, args, responseData["error"], Constants.messageTypes.ERROR, 'get_ats_details_failed', null, rawArgs);
7171
resolve({});
7272
}

bin/helpers/utils.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,12 +971,6 @@ exports.setLocalArgs = (bsConfig, args) => {
971971
if (bsConfig["connection_settings"]["useCaCertificate"])
972972
local_args['useCaCertificate'] = bsConfig["connection_settings"]["useCaCertificate"];
973973

974-
if (Constants.turboScaleObj.enabled) {
975-
local_args['forceLocal'] = true;
976-
local_args['localIdentifier'] = 'ats-repeater';
977-
local_args['custom-repeater'] = Constants.turboScaleObj.gridDetails.customRepeaters.join(',');
978-
}
979-
980974
local_args['daemon'] = true;
981975
local_args['enable-logging-for-api'] = true
982976
local_args['source'] = `cypress:${usageReporting.cli_version_and_path(bsConfig).version}`;

0 commit comments

Comments
 (0)