Files
dify-plugin-daemon/integration/plugin/agent_integration_test.go
Yeuoly 4b75eed6b7 refactor: separate CI tests, and support pg bouncer (#529)
* feat: add support for PgBouncer in database initialization

* refactor: consolidate gorm configuration for database connection

* Add MySQL and multi-driver DB integration tests (#535)

* feat: streamline integration tests by using a centralized docker-compose file

* fix: add timeout

* refactor: replace inline service definitions with docker-compose action for integration tests

* fix: update pgbouncer image and environment variable names for consistency
2025-12-17 22:08:47 +08:00

56 lines
1.6 KiB
Go

package integration_test
import (
_ "embed"
"testing"
"github.com/langgenius/dify-plugin-daemon/internal/core/io_tunnel/access_types"
testutils "github.com/langgenius/dify-plugin-daemon/internal/core/testutils"
"github.com/langgenius/dify-plugin-daemon/pkg/entities/agent_entities"
"github.com/langgenius/dify-plugin-daemon/pkg/entities/requests"
"github.com/langgenius/dify-plugin-daemon/pkg/utils/parser"
"github.com/langgenius/dify-plugin-daemon/pkg/utils/routine"
"github.com/stretchr/testify/assert"
)
//go:embed testdata/langgenius-agent_0.0.14.difypkg
var difyOfficialAgent []byte
//go:embed testdata/invoke_agent_strategy_json.json
var invokeAgentStrategyJson []byte
const (
_testingPath = "./integration_test_cwd"
)
func TestDifyOfficialAgentIntegration(t *testing.T) {
routine.InitPool(10000)
defer testutils.ClearTestingPath(_testingPath)
runtime, err := testutils.GetRuntime(difyOfficialAgent, _testingPath, 1)
assert.NoError(t, err)
invokePayload, err := parser.UnmarshalJsonBytes2Map(invokeAgentStrategyJson)
assert.NoError(t, err)
response, err := testutils.RunOnce[requests.RequestInvokeAgentStrategy, agent_entities.AgentStrategyResponseChunk](
runtime,
access_types.PLUGIN_ACCESS_TYPE_AGENT_STRATEGY,
access_types.PLUGIN_ACCESS_ACTION_INVOKE_AGENT_STRATEGY,
requests.RequestInvokeAgentStrategy{
InvokeAgentStrategySchema: requests.InvokeAgentStrategySchema{
AgentStrategyProvider: "agent",
AgentStrategy: "function_calling",
AgentStrategyParams: invokePayload,
},
},
)
assert.NoError(t, err)
for response.Next() {
_, err := response.Read()
assert.NoError(t, err)
}
}