This saves time when testing on CPU which is the only sensible thing to do on GitHub CI for PRs. For releases or once the commit is merged we could use an external runner with GPU or just wait. Signed-off-by: Richard Palethorpe <io@richiejp.com>
33 lines
634 B
Go
33 lines
634 B
Go
package agent_test
|
|
|
|
import (
|
|
"net/url"
|
|
"os"
|
|
"testing"
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
func TestAgent(t *testing.T) {
|
|
RegisterFailHandler(Fail)
|
|
RunSpecs(t, "Agent test suite")
|
|
}
|
|
|
|
var (
|
|
testModel = os.Getenv("LOCALAGI_MODEL")
|
|
apiURL = os.Getenv("LOCALAI_API_URL")
|
|
apiKey = os.Getenv("LOCALAI_API_KEY")
|
|
useRealLocalAI bool
|
|
clientTimeout = "10m"
|
|
)
|
|
|
|
func isValidURL(u string) bool {
|
|
parsed, err := url.ParseRequestURI(u)
|
|
return err == nil && parsed.Scheme != "" && parsed.Host != ""
|
|
}
|
|
|
|
func init() {
|
|
useRealLocalAI = isValidURL(apiURL) && apiURL != "" && testModel != ""
|
|
}
|