Skip to content

Commit

Permalink
test(setup-e2e): Add checks for folder permissions and OTP binary.
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Jun 17, 2022
1 parent 2b70cb5 commit 2e79605
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions __tests__/test-utils/setup-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const {
} = require('./utils')

const serverJarFilename = 'dt-latest-dev.jar'
const otpJarMavenUrl = 'https://repo1.maven.org/maven2/org/opentripplanner/otp/1.4.0/otp-1.4.0-shaded.jar'
const otpJarForOtpRunner = '/opt/otp/otp-v1.4.0'
const ENV_YML_VARIABLES = [
'AUTH0_CLIENT_ID',
'AUTH0_DOMAIN',
Expand Down Expand Up @@ -333,10 +335,7 @@ async function startOtp () {
console.log('downloading otp jar')

// download otp
await downloadFile(
'https://repo1.maven.org/maven2/org/opentripplanner/otp/1.4.0/otp-1.4.0-shaded.jar',
otpJarFilename
)
await downloadFile(otpJarMavenUrl, otpJarFilename)

console.log('starting otp')
// Ensure default folder for graphs exists.
Expand Down Expand Up @@ -407,6 +406,19 @@ async function verifySetupForLocalEnvironment () {
}
]

// Make sure that certain e2e folders have permissions (assumes running on Linux/MacOS).
const desiredMode = 0o2777
await fs.ensureDir('/tmp/otp', desiredMode) // For otp-runner manifest files
await fs.ensureDir('/tmp/otp/graphs', desiredMode) // For OTP graph
await fs.ensureDir('/var/log', desiredMode) // For otp-runner log
await fs.ensureDir('/opt/otp', desiredMode) // For OTP jar referenced by otp-runner

// Download OTP jar into /opt/otp/ if not already present.
const otpJarExists = await fs.exists(otpJarForOtpRunner)
if (!otpJarExists) {
await downloadFile(otpJarMavenUrl, otpJarForOtpRunner)
}

await Promise.all(
endpointChecks.map(
endpoint => (
Expand Down

0 comments on commit 2e79605

Please sign in to comment.