-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update evaluator tests to use proper AnswerAction type (#58)
* fix: update evaluator tests to use proper AnswerAction type Co-Authored-By: Han Xiao <[email protected]> * fix: increase token budget and mock external calls in agent test Co-Authored-By: Han Xiao <[email protected]> * test: add Docker build and container tests Co-Authored-By: Han Xiao <[email protected]> * feat: add health check endpoint for Docker container verification Co-Authored-By: Han Xiao <[email protected]> * chore: add Docker test script to package.json Co-Authored-By: Han Xiao <[email protected]> * ci: add Docker test step to CI workflow Co-Authored-By: Han Xiao <[email protected]> * fix: remove unused stdout variable in docker test Co-Authored-By: Han Xiao <[email protected]> close #53 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Han Xiao <[email protected]>
- Loading branch information
1 parent
8af35c6
commit 2efae96
Showing
6 changed files
with
110 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { exec } from 'child_process'; | ||
import { promisify } from 'util'; | ||
|
||
const execAsync = promisify(exec); | ||
|
||
describe('Docker build', () => { | ||
jest.setTimeout(300000); // 5 minutes for build | ||
|
||
it('should build Docker image successfully', async () => { | ||
const { stderr } = await execAsync('docker build -t node-deepresearch-test .'); | ||
expect(stderr).not.toContain('error'); | ||
}); | ||
|
||
it('should start container and respond to health check', async () => { | ||
// Start container with mock API keys | ||
await execAsync( | ||
'docker run -d --name test-container -p 3001:3000 ' + | ||
'-e GEMINI_API_KEY=mock_key ' + | ||
'-e JINA_API_KEY=mock_key ' + | ||
'node-deepresearch-test' | ||
); | ||
|
||
// Wait for container to start | ||
await new Promise(resolve => setTimeout(resolve, 5000)); | ||
|
||
try { | ||
// Check if server responds | ||
const { stdout } = await execAsync('curl -s http://localhost:3001/health'); | ||
expect(stdout).toContain('ok'); | ||
} finally { | ||
// Cleanup | ||
await execAsync('docker rm -f test-container').catch(console.error); | ||
} | ||
}); | ||
|
||
afterAll(async () => { | ||
// Clean up any leftover containers | ||
await execAsync('docker rm -f test-container').catch(() => {}); | ||
await execAsync('docker rmi node-deepresearch-test').catch(() => {}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters