test: add resilience and benchmark verification

This commit is contained in:
2026-09-24 10:50:50 +03:00
parent 872b69f90e
commit 1f511728c9
13 changed files with 1203 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package main
import (
"strings"
"testing"
)
func TestRunRequiresAddress(t *testing.T) {
tests := []struct {
name string
host string
port string
want string
}{
{name: "missing host", port: "8080", want: "APP_HOST is required"},
{name: "missing port", host: "127.0.0.1", want: "APP_PORT is required"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Setenv("APP_HOST", tt.host)
t.Setenv("APP_PORT", tt.port)
if err := run(nil); err == nil || !strings.Contains(err.Error(), tt.want) {
t.Fatalf("run() error = %v, want %q", err, tt.want)
}
})
}
}