Skip to content

Commit

Permalink
Print out stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
pflooky committed Jul 1, 2024
1 parent f76b504 commit 37c4424
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 28 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 22 additions & 13 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ function createDataCatererDockerRunCommand(
}
return `docker run -d -p 4040:4040 \
--network insta-infra_default \
--name data-caterer \
-v ${confFolder}:/opt/app/custom \
-v ${sharedFolder}:/opt/app/shared \
-e LOG_LEVEL=debug \
-e APPLICATION_CONFIG_PATH=/opt/app/custom/application.conf \
-e PLAN_FILE_PATH=/opt/app/custom/plan/${planName} \
${dockerEnvVars.join(' ')} \
Expand Down
33 changes: 21 additions & 12 deletions src/data-caterer.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function extractDataGenerationTasks(
currentTasks.push(task)
}

// Need to add data gen task to notify this process that data caterer is one generating data and application can run
// Need to add data gen task to notify this process that data caterer is done generating data and application can run
if (currentPlan.tasks.some(t => t.dataSourceName === 'csv')) {
const csvTask = currentTasks.find(t => t.name === 'csv-task')
csvTask.steps.push(notifyGenerationDoneTask())
Expand Down Expand Up @@ -258,6 +258,19 @@ function extractDataCatererEnv(testConfig) {
return testConfig.env ? testConfig.env : {}
}

function createDockerNetwork() {
// Check if network is created, create if it isn't
try {
const network_details = execSync('docker network ls')
if (!network_details.toString().includes('insta-infra_default')) {
core.info('Creating docker network: insta-infra_default')
execSync('docker network create insta-infra_default')
}
} catch (error) {
core.error(error)
}
}

function runDataCaterer(
testConfig,
appIndex,
Expand Down Expand Up @@ -293,6 +306,7 @@ function runDataCaterer(
'my-validations.yaml',
currValidations
)
createDockerNetwork()
const dockerRunCommand = createDataCatererDockerRunCommand(
true,
dataCatererVersion,
Expand All @@ -301,16 +315,6 @@ function runDataCaterer(
'my-plan.yaml',
dataCatererEnv
)
// Check if network is created, create if it isn't
try {
const network_details = execSync('docker network ls')
if (!network_details.toString().includes('insta-infra_default')) {
core.info('Creating docker network: insta-infra_default')
execSync('docker network create insta-infra_default')
}
} catch (error) {
core.error(error)
}

core.debug(
`Running docker command for data-caterer, command=${dockerRunCommand}`
Expand All @@ -335,8 +339,12 @@ async function checkExistsWithTimeout(filePath, timeout = 60000) {
await new Promise(function (resolve, reject) {
const timer = setTimeout(function () {
watcher.close()
core.info('Checking data-caterer logs')
core.info(execSync('docker logs data-caterer').toString())
reject(
new Error('File did not exists and was not created during the timeout.')
new Error(
`File did not exist and was not created during the timeout, file=${filePath}`
)
)
}, timeout)

Expand Down Expand Up @@ -418,6 +426,7 @@ async function runTests(parsedConfig, configFileDirectory, baseFolder) {
configurationFolder,
sharedFolder
)
core.info('Waiting for data generation to be completed')
await waitForDataGeneration(sharedFolder, i)
core.info('Running application/job')
execSync(runConf.command, { cwd: configFileDirectory })
Expand Down

0 comments on commit 37c4424

Please sign in to comment.