-
Notifications
You must be signed in to change notification settings - Fork 34
Feature/integration tests #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: Integration Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, develop] | ||
| pull_request: | ||
| branches: [main, develop] | ||
|
|
||
| jobs: | ||
| integration-tests: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| services: | ||
| redis: | ||
| image: redis:7-alpine | ||
| ports: | ||
| - 6379:6379 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| postgres: | ||
| image: postgres:15-alpine | ||
| env: | ||
| POSTGRES_USER: chenaikit | ||
| POSTGRES_PASSWORD: testpass | ||
| POSTGRES_DB: chenaikit_test | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '18' | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: 8 | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build packages | ||
| run: pnpm build | ||
|
|
||
| - name: Run integration tests | ||
| env: | ||
| DATABASE_URL: postgresql://chenaikit:testpass@localhost:5432/chenaikit_test | ||
| REDIS_URL: redis://localhost:6379 | ||
| JWT_SECRET: test-secret-key | ||
| NODE_ENV: test | ||
| run: | | ||
| cd tests/integration | ||
| pnpm test --coverage | ||
|
|
||
| - name: Upload coverage | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| files: ./tests/integration/coverage/lcov.info | ||
| flags: integration | ||
| name: integration-tests | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -321,11 +321,12 @@ export class ApiKeyService { | |||||||||||||||||||
| requestsThisMonth, | ||||||||||||||||||||
| averageResponseTime: avgResponseTime._avg.responseTime || 0, | ||||||||||||||||||||
| successRate, | ||||||||||||||||||||
| topEndpoints: endpointCounts.map(item => ({ | ||||||||||||||||||||
| topEndpoints: endpointCounts.map((item: any) => ({ | ||||||||||||||||||||
| endpoint: item.endpoint, | ||||||||||||||||||||
| count: item._count, | ||||||||||||||||||||
| })), | ||||||||||||||||||||
| dailyUsage: dailyCounts.map(item => ({ | ||||||||||||||||||||
| <<<<<<< HEAD | ||||||||||||||||||||
| dailyUsage: (dailyCounts as any[]).map((item: any) => ({ | ||||||||||||||||||||
| date: item.date, | ||||||||||||||||||||
| requests: Number(item.requests), | ||||||||||||||||||||
| })), | ||||||||||||||||||||
|
Comment on lines
+328
to
332
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Search for unresolved merge conflict markers
rg -n "^(<<<<<<<|=======|>>>>>>>)" --type tsRepository: nexoraorg/chenaikit Length of output: 117 🏁 Script executed: # Read the file around the merge conflict marker
sed -n '320,340p' backend/src/services/apiKeyService.ts | cat -nRepository: nexoraorg/chenaikit Length of output: 813 🏁 Script executed: # Search for merge markers in any position
rg "(<<<<<<<|=======|>>>>>>>)" backend/src/services/apiKeyService.ts -nRepository: nexoraorg/chenaikit Length of output: 79 🏁 Script executed: # Check the full file to find if there are other merge markers
rg "^(=======|>>>>>>>)" backend/src/services/apiKeyService.ts -n
# Also check file length to understand scope
wc -l backend/src/services/apiKeyService.tsRepository: nexoraorg/chenaikit Length of output: 104 🏁 Script executed: # Get more context around the marker and check what follows
sed -n '325,340p' backend/src/services/apiKeyService.ts | cat -nRepository: nexoraorg/chenaikit Length of output: 579 Critical: Unresolved merge conflict marker at line 328 must be removed. The file contains an incomplete Git merge conflict marker ( 🐛 Fix: Remove merge conflict marker-<<<<<<< HEAD
dailyUsage: (dailyCounts as any[]).map((item: any) => ({
date: item.date,
requests: Number(item.requests),
})),📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (2.4.6)[error] 328-328: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '<<'. (parse) [error] 328-328: Expected an expression but instead found '<<'. (parse) [error] 328-328: Expected an expression but instead found '<<'. (parse) [error] 329-329: expected (parse) [error] 329-329: Expected a semicolon or an implicit semicolon after a statement, but found none (parse) [error] 331-331: Expected a semicolon or an implicit semicolon after a statement, but found none (parse) [error] 332-332: Expected a statement but instead found ')),'. (parse) 🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,10 +16,12 @@ | |
| "test:cli": "cd packages/cli && jest --coverage", | ||
| "test:backend": "cd backend && jest --coverage", | ||
| "test:frontend": "cd frontend && react-scripts test --coverage --watchAll=false", | ||
| "test:integration": "cd backend && jest --config=jest.integration.config.js", | ||
| "test:integration": "cd tests/integration && pnpm test", | ||
| "test:integration:ci": "cd tests/integration && ./run-tests.sh", | ||
| "test:watch": "jest --watch", | ||
| "test:ci": "jest --coverage --ci --watchAll=false --maxWorkers=2", | ||
| "test:unit": "jest --testPathIgnorePatterns=integration", | ||
| "test:all": "pnpm test && pnpm test:backend && pnpm test:frontend && pnpm test:integration", | ||
|
Comment on lines
+19
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check CI workflow artifact paths
rg -n 'coverage' .github/workflows/ci.ymlRepository: nexoraorg/chenaikit Length of output: 296 🏁 Script executed: #!/bin/bash
# Get full context of CI workflow around coverage references
head -n 100 .github/workflows/ci.yml | tail -n 70Repository: nexoraorg/chenaikit Length of output: 1681 🏁 Script executed: #!/bin/bash
# Check what test:integration script does
cat tests/integration/run-tests.shRepository: nexoraorg/chenaikit Length of output: 1484 🏁 Script executed: #!/bin/bash
# Check if integration tests generate coverage
rg -A 5 -B 5 'backend/coverage' .github/workflows/ci.ymlRepository: nexoraorg/chenaikit Length of output: 309 Fix CI artifact path for integration test coverage. The 🤖 Prompt for AI Agents |
||
| "coverage": "jest --coverage && open coverage/lcov-report/index.html", | ||
| "coverage:report": "jest --coverage --coverageReporters=text-summary", | ||
| "lint": "pnpm -r lint", | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,6 @@ packages: | |
| - 'packages/*' | ||
| - 'examples/*' | ||
| - 'tests/*' | ||
| - 'tests/integration' | ||
| - 'backend' | ||
| - 'frontend' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Test environment variables | ||
| DATABASE_URL=postgresql://chenaikit:testpass@localhost:5432/chenaikit_test | ||
| REDIS_URL=redis://localhost:6379 | ||
| JWT_SECRET=test-secret-key-do-not-use-in-production | ||
| NODE_ENV=test | ||
| API_URL=http://localhost:3000 | ||
|
|
||
| # Stellar testnet | ||
| STELLAR_NETWORK=testnet | ||
| HORIZON_URL=https://horizon-testnet.stellar.org | ||
|
|
||
| # AI API Keys (optional - tests will use mocks if not provided) | ||
| # OPENAI_API_KEY=your-test-key | ||
| # HUGGINGFACE_API_KEY=your-test-key |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
| pnpm-lock.yaml | ||
|
|
||
| # Test output | ||
| coverage/ | ||
| *.log | ||
|
|
||
| # Environment | ||
| .env | ||
| .env.local | ||
| .env.test | ||
|
|
||
| # Build output | ||
| dist/ | ||
| *.tsbuildinfo | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage upload path mismatch will cause silent failure.
The workflow changes to
tests/integrationbefore running tests (line 66-67), so Jest outputs coverage to./coverage/relative to that directory. However, the Codecov upload (line 72) expects./tests/integration/coverage/lcov.inforelative to the repo root, which resolves totests/integration/tests/integration/coverage/lcov.info.Either add
coverageDirectoryto jest.config.js or fix the upload path.🛠️ Option 1: Fix upload path
🛠️ Option 2: Add coverageDirectory to jest.config.js
In
tests/integration/jest.config.js:Then update the workflow to run from repo root or adjust path accordingly.
🧰 Tools
🪛 actionlint (1.7.11)
[error] 70-70: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents