Skip to content

Commit

Permalink
path hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
csmig committed Feb 27, 2025
1 parent e75eac0 commit 7276bff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-state-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: which node; which docker; which python3
- name: Run tests
working-directory: ./test/state
run: ./node_modules/mocha/bin/mocha.js --reporter mochawesome --showFailed --exit './mocha/**/*.test.js'
run: npm test
- name: Upload mocha test report
id: artifact-upload-mocha
uses: actions/upload-artifact@v4
Expand Down
12 changes: 7 additions & 5 deletions test/state/mocha/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import * as readline from 'node:readline'
import { dirname } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))

const nodePath = '/usr/local/bin/node'
const pythonPath = '/usr/bin/python3'
const dockerPath = '/usr/bin/docker'
export async function spawnApiWait (env) {
return new Promise((resolve, reject) => {
const api = spawn('node', [`${__dirname}/../../../api/source/index.js`], {env})
const api = spawn(nodePath, [`${__dirname}/../../../api/source/index.js`], {env})

api.on('error', (err) => {
reject(err)
Expand Down Expand Up @@ -39,7 +41,7 @@ export async function spawnApiWait (env) {
export async function spawnApi (env) {
return new Promise((resolve, reject) => {
console.log(JSON.stringify(process.env))
const api = spawn('node', [`${__dirname}/../../../api/source/index.js`], {env})
const api = spawn(nodePath, [`${__dirname}/../../../api/source/index.js`], {env})

api.on('error', (err) => {
reject(err)
Expand Down Expand Up @@ -102,7 +104,7 @@ export async function simpleRequest(url, method) {
export function spawnMySQL (tag = '8.0.41', port = '3306') {
let readyCount = 0
return new Promise((resolve, reject) => {
const child = spawn('docker', [
const child = spawn(dockerPath, [
'run', '--rm',
// '--name', 'test-mysql',
'-p', `${port}:3306`,
Expand Down Expand Up @@ -145,7 +147,7 @@ export function spawnMySQL (tag = '8.0.41', port = '3306') {
}

export function spawnMockKeycloak (port = '8080') {
const child = spawn('python3', ['-m', 'http.server', port], {cwd: `${__dirname}/../../api/mock-keycloak`})
const child = spawn(pythonPath, ['-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 7276bff

Please sign in to comment.