@applitools/execution-grid-tunnel
Advanced tools
Comparing version 2.1.6 to 2.1.7
{ | ||
"name": "@applitools/execution-grid-tunnel", | ||
"version": "2.1.6", | ||
"version": "2.1.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "scripts/run-execution-grid-tunnel.js", |
@@ -15,5 +15,12 @@ const fs = require('fs') | ||
async function downloadFrpc({platform, arch, cacheDirectoryPath, frpcPath, shouldUpdate}) { | ||
async function downloadFrpc({ | ||
platform, | ||
arch, | ||
cacheDirectoryPath, | ||
frpcPath, | ||
shouldUpdate, | ||
egTunnelManagerUrl, | ||
}) { | ||
const expectedHash = getExpectedBinHash({platform, arch}) | ||
const url = getFrpcDownloadLink({platform, arch}) | ||
const url = getFrpcDownloadLink({platform, arch, egTunnelManagerUrl}) | ||
@@ -41,4 +48,8 @@ try { | ||
function getFrpcDownloadLink({platform, arch}) { | ||
return `https://exec-wus.applitools.com/frpc/${frpcVersion}/${platform}/${arch}` | ||
function getFrpcDownloadLink({ | ||
platform, | ||
arch, | ||
egTunnelManagerUrl = 'https://exec-wus.applitools.com', | ||
}) { | ||
return `${egTunnelManagerUrl}/frpc/${frpcVersion}/${platform}/${arch}` | ||
} | ||
@@ -58,2 +69,3 @@ | ||
cacheDirectoryPath, | ||
egTunnelManagerUrl, | ||
_frpcPath, | ||
@@ -65,3 +77,7 @@ }) { | ||
return `${prefix}. You can download the file from ${getFrpcDownloadLink({platform, arch})}` | ||
return `${prefix}. You can download the file from ${getFrpcDownloadLink({ | ||
platform, | ||
arch, | ||
egTunnelManagerUrl, | ||
})}` | ||
} | ||
@@ -68,0 +84,0 @@ |
'use strict' | ||
const os = require('os') | ||
const path = require('path') | ||
const crypto = require('crypto'); | ||
const crypto = require('crypto') | ||
const {promises: fs, existsSync, statSync} = require('fs') | ||
const nodeCleanup = require('node-cleanup') | ||
const { getExpectedBinHash, getBinHash, getSupportedPlatformAndArchList } = require('@applitools/eg-frpc') | ||
const { | ||
getExpectedBinHash, | ||
getBinHash, | ||
getSupportedPlatformAndArchList, | ||
} = require('@applitools/eg-frpc') | ||
@@ -20,3 +24,3 @@ const {getCacheDirectoryPath, FrpcDownloadError} = require('../src/utils') | ||
} = require('../src/utils') | ||
const { downloadFrpc, getFrpcDownloadLink, getManualFrpcInstallingErrorMessage } = require('./frpc') | ||
const {downloadFrpc, getFrpcDownloadLink, getManualFrpcInstallingErrorMessage} = require('./frpc') | ||
@@ -38,9 +42,14 @@ const createApp = require('../src/execution-grid-tunnel') | ||
const CACHE_DIRECTORY_PATH = process.env.APPLITOOLS_EG_FRPC_CACHE_DIRECTORY || path.join(getCacheDirectoryPath(os.platform()), 'eg-applitools') | ||
const CACHE_DIRECTORY_PATH = | ||
process.env.APPLITOOLS_EG_FRPC_CACHE_DIRECTORY || | ||
path.join(getCacheDirectoryPath(os.platform()), 'eg-applitools') | ||
async function prepareEnvironment({ | ||
shouldInstallFrpc = true, | ||
customTestCacheDirectoryPath | ||
}= {}){ | ||
const platform = PLATFORM, arch = ARCH | ||
customTestCacheDirectoryPath, | ||
egTunnelManagerUrl = process.env.APPLITOOLS_EG_TUNNEL_MANAGER_URL || | ||
'https://exec-wus.applitools.com', | ||
} = {}) { | ||
const platform = PLATFORM, | ||
arch = ARCH | ||
const cacheDirectoryPath = customTestCacheDirectoryPath || CACHE_DIRECTORY_PATH | ||
@@ -52,8 +61,10 @@ const fileSuffix = PLATFORM === 'win32' ? '.exe' : '' | ||
const isPlatformAndArchSupported = getSupportedPlatformAndArchList().some(item => item.platform === platform && item.arch === arch) | ||
const isPlatformAndArchSupported = getSupportedPlatformAndArchList().some( | ||
(item) => item.platform === platform && item.arch === arch, | ||
) | ||
if (!isPlatformAndArchSupported) { | ||
throw `execution-grid-tunnel doesn't support ${PLATFORM} with ${ARCH} architecture yet` | ||
} | ||
const expectedHash = getExpectedBinHash({platform, arch}) | ||
@@ -65,4 +76,11 @@ | ||
if (!isExpectedFrpc && !shouldInstallFrpc) { | ||
const url = getFrpcDownloadLink({platform, arch}) | ||
const message = getManualFrpcInstallingErrorMessage({platform, arch, cacheDirectoryPath, frpcPath, shouldUpdate: isFrpcExist}) | ||
const url = getFrpcDownloadLink({platform, arch, egTunnelManagerUrl}) | ||
const message = getManualFrpcInstallingErrorMessage({ | ||
platform, | ||
arch, | ||
cacheDirectoryPath, | ||
frpcPath, | ||
shouldUpdate: isFrpcExist, | ||
egTunnelManagerUrl, | ||
}) | ||
throw new FrpcDownloadError(url, CACHE_DIRECTORY_PATH, frpcPath, message) | ||
@@ -72,7 +90,13 @@ } | ||
if (!isExpectedFrpc) { | ||
await downloadFrpc({platform, arch, cacheDirectoryPath, frpcPath ,expectedHash}) | ||
await downloadFrpc({ | ||
platform, | ||
arch, | ||
cacheDirectoryPath, | ||
frpcPath, | ||
expectedHash, | ||
egTunnelManagerUrl, | ||
}) | ||
} | ||
return {frpcPath} | ||
} | ||
@@ -108,5 +132,7 @@ | ||
if (logger){ | ||
if (logger) { | ||
if (!logger.info || !logger.warn || !logger.error) | ||
throw new Error('Logger should support the next functions: logger.info, logger.warn, logger.log, logger.error') | ||
throw new Error( | ||
'Logger should support the next functions: logger.info, logger.warn, logger.log, logger.error', | ||
) | ||
} | ||
@@ -121,3 +147,3 @@ | ||
}) | ||
const {frpcPath} = await prepareEnvironment({shouldInstallFrpc, customTestCacheDirectoryPath}) | ||
@@ -245,4 +271,2 @@ | ||
module.exports = {startEgTunnelService, prepareEnvironment} |
@@ -8,3 +8,3 @@ 'use strict' | ||
function createApp({ | ||
egTunnelManagerUrl, | ||
egTunnelManagerUrl = 'https://exec-wus.applitools.com', | ||
tunnelConfigFileDirectory, | ||
@@ -11,0 +11,0 @@ logFileDirectory, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48296
1397
25