Files
mcr/internal/grpcserver/admin_test.go
Kyle Isom d5580f01f2 Migrate module path from kyle/ to mc/ org
All import paths updated to git.wntrmute.dev/mc/. Bumps mcdsl to v1.2.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 02:05:59 -07:00

43 lines
951 B
Go

package grpcserver
import (
"context"
"testing"
pb "git.wntrmute.dev/mc/mcr/gen/mcr/v1"
)
func TestHealthReturnsOk(t *testing.T) {
deps := adminDeps(t)
cc := startTestServer(t, deps)
client := pb.NewAdminServiceClient(cc)
resp, err := client.Health(context.Background(), &pb.HealthRequest{})
if err != nil {
t.Fatalf("Health: %v", err)
}
if resp.GetStatus() != "ok" {
t.Fatalf("status: got %q, want %q", resp.Status, "ok")
}
}
func TestHealthWithoutAuth(t *testing.T) {
mcias := mockMCIAS(t)
auth := testAuthenticator(t, mcias.URL)
database := openTestDB(t)
cc := startTestServer(t, Deps{
DB: database,
Authenticator: auth,
})
client := pb.NewAdminServiceClient(cc)
resp, err := client.Health(context.Background(), &pb.HealthRequest{})
if err != nil {
t.Fatalf("Health without auth should succeed: %v", err)
}
if resp.GetStatus() != "ok" {
t.Fatalf("status: got %q, want %q", resp.Status, "ok")
}
}