Skip to content

Commit

Permalink
workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
csmig committed Feb 27, 2025
1 parent 5b2b740 commit dda8e2c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/state/mocha/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import { dirname } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))

const nodeCmd = 'node'
const pythonCmd = 'python3'
const dockerCmd = 'docker'
// workqround PATH envvar not being used by spawn in github actions
const nodeCmd = process.env.GITHUB_RUN_ID ? '/usr/local/bin/node':'node'
const pythonCmd = process.env.GITHUB_RUN_ID ? '/usr/bin/python3':'python3'
const dockerCmd = process.env.GITHUB_RUN_ID ? '/usr/bin/docker':'docker'

// console.log(JSON.stringify(process.env, null, 2))

export async function spawnApiWait (env) {
return new Promise((resolve, reject) => {
const api = spawn(nodeCmd, [`${__dirname}/../../../api/source/index.js`], {env, shell:true})
const api = spawn(nodeCmd, [`${__dirname}/../../../api/source/index.js`], {env})

api.on('error', (err) => {
reject(err)
Expand Down Expand Up @@ -116,7 +117,7 @@ export function spawnMySQL (tag = '8.0.41', port = '3306') {
'-e', 'MYSQL_USER=stigman',
'-e', 'MYSQL_PASSWORD=stigman',
`mysql:${tag}`
], {shell:true})
])
child.on('exit', (code) => {
if (code !== 0) {
reject(new Error(`EXIT: Command failed with code ${code}`))
Expand Down Expand Up @@ -150,7 +151,7 @@ export function spawnMySQL (tag = '8.0.41', port = '3306') {
}

export function spawnMockKeycloak (port = '8080') {
const child = spawn(pythonCmd, ['-m', 'http.server', port], {cwd: `${__dirname}/../../api/mock-keycloak`, shell:true})
const child = spawn(pythonCmd, ['-m', 'http.server', port], {cwd: `${__dirname}/../../api/mock-keycloak`})
// child.on('exit', (code) => {
// console.log(`EXIT: Mock Keycloak server exited with code ${code}`);
// })
Expand Down

0 comments on commit dda8e2c

Please sign in to comment.