Wait for API to be ready
This commit is contained in:
@@ -3,6 +3,7 @@ package agent_test
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -112,6 +113,15 @@ func (a *FakeInternetAction) Definition() types.ActionDefinition {
|
||||
|
||||
var _ = Describe("Agent test", func() {
|
||||
Context("jobs", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
Eventually(func() error {
|
||||
// test apiURL is working and available
|
||||
_, err := http.Get(apiURL + "/readyz")
|
||||
return err
|
||||
}, "10m", "10s").ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("pick the correct action", func() {
|
||||
agent, err := New(
|
||||
WithLLMAPIURL(apiURL),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package e2e_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
localagi "github.com/mudler/LocalAGI/pkg/client"
|
||||
@@ -11,6 +12,14 @@ import (
|
||||
|
||||
var _ = Describe("Agent test", func() {
|
||||
Context("Creates an agent and it answers", func() {
|
||||
BeforeEach(func() {
|
||||
Eventually(func() error {
|
||||
// test apiURL is working and available
|
||||
_, err := http.Get(apiURL + "/readyz")
|
||||
return err
|
||||
}, "10m", "10s").ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("create agent", func() {
|
||||
client := localagi.NewClient(localagiURL, "", 5*time.Minute)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user