try to fixup tests, enable e2e (#53)

* try to fixup tests, enable e2e

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Generate JSON character data with tools

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Rework generation of character

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Simplify text

Signed-off-by: mudler <mudler@localai.io>

* Relax some test constraints

Signed-off-by: mudler <mudler@localai.io>

* Fixups

* Properly fit schema generation

* Swap default model

* ci fixups

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-03-18 23:28:02 +01:00
committed by GitHub
parent 31b5849d02
commit e32a569796
16 changed files with 733 additions and 144 deletions

View File

@@ -0,0 +1,27 @@
package e2e_test
import (
"os"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestE2E(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "E2E test suite")
}
var testModel = os.Getenv("LOCALAGENT_MODEL")
var apiURL = os.Getenv("LOCALAI_API_URL")
var localagentURL = os.Getenv("LOCALAGENT_API_URL")
func init() {
if testModel == "" {
testModel = "hermes-2-pro-mistral"
}
if apiURL == "" {
apiURL = "http://192.168.68.113:8080"
}
}

26
tests/e2e/e2e_test.go Normal file
View File

@@ -0,0 +1,26 @@
package e2e_test
import (
localagent "github.com/mudler/LocalAgent/pkg/client"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Agent test", func() {
Context("Creates an agent and it answer", func() {
It("create agent", func() {
client := localagent.NewClient(localagentURL, "")
err := client.CreateAgent(&localagent.AgentConfig{
Name: "testagent",
})
Expect(err).ToNot(HaveOccurred())
result, err := client.SimpleAIResponse("testagent", "hello")
Expect(err).ToNot(HaveOccurred())
Expect(result).ToNot(BeEmpty())
})
})
})