From 60f739ceb91fce0ec7e5518f666f1207f3b39395 Mon Sep 17 00:00:00 2001 From: Julian lechner Date: Thu, 8 Oct 2026 12:19:18 +0200 Subject: [PATCH] fix(qmd): repair integration test, pull models first, reorder CI steps Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/ci.yml | 4 ++-- scripts/tests/test-qmd-integration.mjs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f601568..216f927 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -184,12 +184,12 @@ jobs: node-version: '24' - name: Install QMD run: npm install --global @tobilu/qmd@2.8.3 + - name: Run QMD unit tests + run: node --test scripts/tests/test-qmd-lib.mjs scripts/tests/test-qmd-daemon.mjs scripts/tests/test-qmd-search.mjs scripts/tests/test-qmd-warm.mjs scripts/tests/test-qmd-benchmark.mjs - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .cache/qmd-models key: qmd-models-${{ runner.os }}-2.8.3-qwen3 - - name: Run QMD unit tests - run: node --test scripts/tests/test-qmd-lib.mjs scripts/tests/test-qmd-daemon.mjs scripts/tests/test-qmd-search.mjs scripts/tests/test-qmd-warm.mjs scripts/tests/test-qmd-benchmark.mjs - name: Run QMD integration test with real models env: QMD_TEST_CACHE: ${{ github.workspace }}/.cache/qmd-models diff --git a/scripts/tests/test-qmd-integration.mjs b/scripts/tests/test-qmd-integration.mjs index cdd8537..341b0e1 100644 --- a/scripts/tests/test-qmd-integration.mjs +++ b/scripts/tests/test-qmd-integration.mjs @@ -6,7 +6,9 @@ import { mkdtempSync, mkdirSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join, resolve } from 'node:path'; -const search = resolve('shared/qmd/qmd-search.mjs'); +import { runQmdCli } from '../../shared/qmd/qmd-lib.mjs'; + +const search =resolve('shared/qmd/qmd-search.mjs'); test('wrapper finds the retry logic through the daemon and stops it', { timeout: 1_800_000 }, () => { const home = mkdtempSync(join(tmpdir(), 'qmd-it-home-')); @@ -18,7 +20,8 @@ test('wrapper finds the retry logic through the daemon and stops it', { timeout: execFileSync('git', ['add', '-A'], { cwd: repo }); const env = { ...process.env, HOME: home, USERPROFILE: home, XDG_CONFIG_HOME: join(home, '.config'), XDG_CACHE_HOME: process.env.QMD_TEST_CACHE || join(home, '.cache'), QMD_FORCE_CPU: '1' }; execFileSync('node', ['shared/qmd/qmd-config.mjs', 'set-models'], { env }); - const results = JSON.parse(execFileSync('node', [search, '--root', repo, '--query', 'Where are failed uploads retried after temporary errors?'], { env, encoding: 'utf8', timeout: 1_700_000 })); - assert.equal(results[0].path.replace(/\/g, '/'), 'src/upload.ts'); + runQmdCli(['pull'], { env, timeout: 1_700_000, stdio: 'inherit' }); // download models first so the search only measures indexing and query + const results =JSON.parse(execFileSync('node', [search, '--root', repo, '--query', 'Where are failed uploads retried after temporary errors?'], { env, encoding: 'utf8', timeout: 1_700_000 })); + assert.equal(results[0].path.replaceAll('\\', '/'), 'src/upload.ts'); execFileSync('node', [search, '--stop'], { env }); });