mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-07-29 06:21:33 +00:00
The in-process scheduler is the sole cron trigger on self-host, so the
/cron/{name} HTTP endpoint and its CRON_SHARED_SECRET are dead surface.
Reduce the HTTP server to GET / (health) and remove the cron secret config,
SSM binding, and now-unused timeout.
20 lines
423 B
Go
20 lines
423 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestHealthHandler_OK(t *testing.T) {
|
|
rec := httptest.NewRecorder()
|
|
HealthHandler()(rec, httptest.NewRequest(http.MethodGet, "/", nil))
|
|
if rec.Code != http.StatusOK {
|
|
t.Errorf("status = %d, want 200", rec.Code)
|
|
}
|
|
if !strings.Contains(rec.Body.String(), "ok") {
|
|
t.Errorf("body = %q, want contains 'ok'", rec.Body.String())
|
|
}
|
|
}
|