diff --git a/.github/workflows/backend-integration.yml b/.github/workflows/backend-integration.yml index 5ba537068..61e55d3c7 100644 --- a/.github/workflows/backend-integration.yml +++ b/.github/workflows/backend-integration.yml @@ -73,11 +73,21 @@ jobs: run: npm run build working-directory: ${{ matrix.node }}/integration/backend + - name: Verify config file exists + run: | + ls -la mempool-config.test.json + echo "Current directory: ${PWD}" + echo "Config file will be: ${{ github.workspace }}/${{ matrix.node }}/integration/backend/mempool-config.test.json" + test -f mempool-config.test.json || (echo "ERROR: Config file not found!" && exit 1) + working-directory: ${{ matrix.node }}/integration/backend + - name: Run integration tests (DB auto-starts via Jest) - run: npm run test:integration + run: | + echo "MEMPOOL_CONFIG_FILE=$MEMPOOL_CONFIG_FILE" + npm run test:integration working-directory: ${{ matrix.node }}/integration/backend env: - MEMPOOL_CONFIG_FILE: ./mempool-config.test.json + MEMPOOL_CONFIG_FILE: ${{ github.workspace }}/${{ matrix.node }}/integration/backend/mempool-config.test.json - name: Start MariaDB for server test run: docker compose -f docker-compose.test.yml up -d @@ -119,7 +129,7 @@ jobs: fi working-directory: ${{ matrix.node }}/integration/backend env: - MEMPOOL_CONFIG_FILE: ./mempool-config.test.json + MEMPOOL_CONFIG_FILE: ${{ github.workspace }}/${{ matrix.node }}/integration/backend/mempool-config.test.json - name: Cleanup containers if: always() diff --git a/backend/package.json b/backend/package.json index aec9b94b3..5a86f015f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -34,7 +34,7 @@ "reindex-all-blocks": "npm run start-production --update-pools --reindex-blocks", "test": "./node_modules/.bin/jest --coverage", "test:ci": "CI=true ./node_modules/.bin/jest --coverage", - "test:integration": "MEMPOOL_CONFIG_FILE=$(pwd)/mempool-config.test.json ./node_modules/.bin/jest --config=jest.integration.config.ts --runInBand --forceExit", + "test:integration": "./node_modules/.bin/jest --config=jest.integration.config.ts --runInBand --forceExit", "test:with-db": "bash ./scripts/test-with-db.sh", "lint": "./node_modules/.bin/eslint . --ext .ts", "lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix", diff --git a/backend/scripts/test-with-db.sh b/backend/scripts/test-with-db.sh index 5b29be8ae..4790b3ca3 100755 --- a/backend/scripts/test-with-db.sh +++ b/backend/scripts/test-with-db.sh @@ -79,11 +79,15 @@ npm run build # Run integration tests with absolute path to config # SKIP_DB_SETUP=1 and SKIP_DB_TEARDOWN=1 tell Jest that we're managing the database lifecycle echo -e "${GREEN}Running integration tests...${NC}" -SKIP_DB_SETUP=1 SKIP_DB_TEARDOWN=1 MEMPOOL_CONFIG_FILE="$BACKEND_DIR/mempool-config.test.json" npm run test:integration +export MEMPOOL_CONFIG_FILE="$BACKEND_DIR/mempool-config.test.json" +export SKIP_DB_SETUP=1 +export SKIP_DB_TEARDOWN=1 +npm run test:integration # Start the backend server in the background +# MEMPOOL_CONFIG_FILE is already exported above echo -e "${GREEN}Starting backend server...${NC}" -MEMPOOL_CONFIG_FILE="$BACKEND_DIR/mempool-config.test.json" node dist/index.js & +node dist/index.js & SERVER_PID=$! # Wait for server to start and verify connection