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