CI / test (push) Successful in 4m15s
Found trying auth.ldap against a Samba DC on the PoC. A CA file a control plane could not use made every control plane exit, and no ctl config could then put the setting right: directory sign-in is now turned off there, and said. `llmgw server check` ran a whole server that, its ports taken, held the leader's lease for three hours: server refuses words it does not know and takes its ports before anything else. The guides now say auth is set with ctl config, not server.yaml. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package router
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/config"
|
|
)
|
|
|
|
// auth.ldap is the cluster's: a CA file one machine lacks must not keep its
|
|
// control plane from starting, where nothing could put the setting right.
|
|
func TestADirectoryThatCannotBeUsedHereLeavesTheGatewayUp(t *testing.T) {
|
|
cfg := baseConfig(config.Endpoint{ID: "a", URL: "http://127.0.0.1:1", Models: []string{"m"}})
|
|
cfg.Auth.Enabled = true
|
|
cfg.Auth.Store = filepath.Join(t.TempDir(), "store.db")
|
|
cfg.Auth.LDAP = config.LDAP{URLs: []string{"ldaps://dc1"}, CAFile: filepath.Join(t.TempDir(), "missing.pem"),
|
|
BindDN: "CN=svc", BindPasswordFile: "/nonexistent", BaseDN: "DC=corp"}
|
|
r := newTestRouter(t, cfg)
|
|
if r.directory != nil {
|
|
t.Fatal("a directory was set up from a CA file that is not there")
|
|
}
|
|
w := httptest.NewRecorder()
|
|
r.Handler().ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/login", nil))
|
|
if w.Code != http.StatusOK || !strings.Contains(w.Body.String(), `type="email"`) {
|
|
t.Errorf("/login: %d", w.Code)
|
|
}
|
|
}
|