Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/commands/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions bin/testObservability/helper/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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: {
Expand All @@ -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) {
Expand Down Expand Up @@ -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(', ');
Expand All @@ -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);
Expand Down Expand Up @@ -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');
Expand Down