Files
Yeuoly 9730b7dc63 tests: enhance integration testing for specific plugins (#242)
* feat: enhance integration testing for specific plugins

- Added integration tests for the official agent, including test data for agent strategy invocation.
- Introduced JSON schema generation and validation utilities to ensure proper request formatting.
- Enhanced mock invocation handling in the plugin manager to support tool parameters.
- Added new test utilities for simulating OpenAI server responses and managing plugin runtime.

* fix: update RunOnce function to return response stream and enhance integration test

- Modified the RunOnce function to return a response stream instead of an error, allowing for better handling of streamed responses.
- Updated the integration test for the official agent to read from the response stream, ensuring proper validation of the agent strategy invocation.
2025-04-24 16:33:50 +08:00

71 lines
1.4 KiB
YAML

name: Run Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
concurrency:
group: test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
options: -e REDIS_PASSWORD=difyai123456
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: difyai123456
POSTGRES_DB: difyai
ports:
- 5432:5432
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: difyai
MYSQL_ROOT_PASSWORD: difyai123456
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=30
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
# setup uv and get uv path to env
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "UV_PATH=$(which uv)" >> $GITHUB_ENV
- name: Setup License
run: go run cmd/license/generate/main.go
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -v -timeout 1m ./...