40 lines
1.4 KiB
Go
40 lines
1.4 KiB
Go
package jeannieworkflow
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestNewExecutionDropsInheritedProfilePin(t *testing.T) {
|
|
t.Setenv("JEANNIE_CLUSTER_PROFILE_PIN", "pimox")
|
|
t.Setenv("JEANNIE_REMOTE_SERVER", "false")
|
|
t.Setenv("JEANNIE_SERVER_ADDR", "127.0.0.1:8787")
|
|
environment := CommandEnvironment()
|
|
for _, entry := range environment {
|
|
if strings.HasPrefix(entry, "JEANNIE_CLUSTER_PROFILE_PIN=") {
|
|
t.Fatal("new operation retained the previous operation's profile pin")
|
|
}
|
|
}
|
|
joined := strings.Join(environment, "\n")
|
|
if !strings.Contains(joined, "JEANNIE_REMOTE_SERVER=true") || !strings.Contains(joined, "JEANNIE_SERVER_ADDR=127.0.0.1:8787") {
|
|
t.Fatal("new operation lost its remote flag or unrelated configuration")
|
|
}
|
|
}
|
|
|
|
func TestCommandTimeoutForLongAILabWork(t *testing.T) {
|
|
for _, action := range []string{"suite", "install", "colibri-install", "colibri-prepare"} {
|
|
if got := CommandTimeout("ai-lab", []string{action}); got != 2*time.Hour {
|
|
t.Errorf("%s timeout = %s", action, got)
|
|
}
|
|
}
|
|
for _, action := range []string{"doctor-prepare", "doctor-suite", "doctor-auto-rank", "doctor-add-external", "doctor-retrieval-bench"} {
|
|
if got := CommandTimeout("ai-lab", []string{action}); got != 6*time.Hour {
|
|
t.Errorf("%s: got %v, want 6h", action, got)
|
|
}
|
|
}
|
|
if got := CommandTimeout("status", nil); got != 30*time.Minute {
|
|
t.Errorf("status timeout = %s", got)
|
|
}
|
|
}
|