Some checks failed
CodeQL / Analyze (go) (push) Successful in 6m28s
Docker Image / build-docker (push) Failing after 13m26s
Lint and Testing / lint (push) Successful in 11m17s
Lint and Testing / test (push) Successful in 11m17s
Lint and Testing / golangci (push) Successful in 2m40s
29 lines
608 B
Go
29 lines
608 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDefaultFile_apiDefaults(t *testing.T) {
|
|
f := DefaultFile()
|
|
if f.API.Addr == "" {
|
|
t.Fatal("expected API listen addr")
|
|
}
|
|
if f.API.ModelsDir == "" {
|
|
t.Fatal("expected models_dir")
|
|
}
|
|
}
|
|
|
|
func TestMkdirTemp_usesTmpRoot(t *testing.T) {
|
|
dir, err := MkdirTemp("go-whisper-api-test-*")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer func() { _ = os.RemoveAll(dir) }()
|
|
if !strings.HasPrefix(dir, TempRoot+"/") {
|
|
t.Fatalf("temp dir should be under %s, got %s", TempRoot, dir)
|
|
}
|
|
}
|