Skip to content

Commit

Permalink
chore: temp log lines
Browse files Browse the repository at this point in the history
Ankit098 committed Jan 28, 2025
1 parent e3f7ea2 commit 91f6595
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bin/commands/runs.js
Original file line number Diff line number Diff line change
@@ -114,8 +114,11 @@ module.exports = function run(args, rawArgs) {

// Send build start to Observability
if(isTestObservabilitySession) {
logger.info('TEMPLOG 1')
await launchTestSession(bsConfig, bsConfigPath);
logger.info('TEMPLOG 2')
utils.setO11yProcessHooks(null, bsConfig, args, null, buildReportData);
logger.info('TEMPLOG 3')
}

// accept the system env list from bsconf and set it
14 changes: 12 additions & 2 deletions bin/testObservability/helper/helper.js
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ const pGitconfig = promisify(gitconfig);
const logger = require("../../helpers/logger").winstonLogger;
const utils = require('../../helpers/utils');
const helper = require('../../helpers/helper');
// const { isTurboScaleSession } = require('../../helpers/atsHelper');

const CrashReporter = require('../crashReporter');

@@ -100,6 +101,7 @@ exports.printBuildLink = async (shouldStopSession, exitCode = null) => {
supportFileCleanup();
await this.stopBuildUpstream();
}
logger.info(`TEMPLOG printBuildLink -- ${process.env.BS_TESTOPS_BUILD_HASHED_ID}`)
try {
if(process.env.BS_TESTOPS_BUILD_HASHED_ID
&& process.env.BS_TESTOPS_BUILD_HASHED_ID != "null"
@@ -400,7 +402,11 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
frameworkName: "Cypress",
frameworkVersion: exports.getPackageVersion('cypress', user_config),
sdkVersion: helper.getAgentVersion()
}
},
// 'product_map': {
// observability: true,
// turboscale: isTurboScaleSession(user_config)
// }
};
const config = {
auth: {
@@ -412,10 +418,11 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
'X-BSTACK-TESTOPS': 'true'
}
};

logger.info(`TEMPLOG 4`)
const response = await nodeRequest('POST','api/v1/builds',data,config);
exports.debug('Build creation successfull!');
process.env.BS_TESTOPS_BUILD_COMPLETED = true;
logger.info(`TEMPLOG DATA ${JSON.stringify(response.data)}`)
setEnvironmentVariablesForRemoteReporter(response.data.jwt, response.data.build_hashed_id, response.data.allow_screenshots, data.observability_version.sdkVersion);
if(this.isBrowserstackInfra()) helper.setBrowserstackCypressCliDependency(user_config);
} catch(error) {
@@ -498,6 +505,7 @@ exports.batchAndPostEvents = async (eventUrl, kind, data) => {
'X-BSTACK-TESTOPS': 'true'
}
};
console.log(`TEMPLOG -- batchAndPostEvents ${config}`);

try {
const eventsUuids = data.map(eventData => `${eventData.event_type}:${eventData.test_run ? eventData.test_run.uuid : (eventData.hook_run ? eventData.hook_run.uuid : null)}`).join(', ');
@@ -511,6 +519,7 @@ exports.batchAndPostEvents = async (eventUrl, kind, data) => {
exports.pending_test_uploads.count = Math.max(0,exports.pending_test_uploads.count - data.length);
}
} catch(error) {
console.log(`TEMPLOG -- batchAndPostEvents error ${util.format(error)}`);
exports.debugOnConsole(`[Request Error] Error in sending request ${util.format(error)}`);
if (error.response) {
exports.debug(`EXCEPTION IN ${kind} REQUEST TO TEST OBSERVABILITY : ${error.response.status} ${error.response.statusText} ${JSON.stringify(error.response.data)}`, true, error);
@@ -662,6 +671,7 @@ exports.shouldReRunObservabilityTests = () => {
}

exports.stopBuildUpstream = async () => {
logger.info(`TEMPLOG stopBuildUpstream -- ${process.env.BS_TESTOPS_BUILD_COMPLETED}`);
if (process.env.BS_TESTOPS_BUILD_COMPLETED === "true") {
if(process.env.BS_TESTOPS_JWT == "null" || process.env.BS_TESTOPS_BUILD_HASHED_ID == "null") {
exports.debug('EXCEPTION IN stopBuildUpstream REQUEST TO TEST OBSERVABILITY : Missing authentication token');

0 comments on commit 91f6595

Please sign in to comment.