Files
smallwebwaf/internal/sww/healthcheck_internal_test.go
T

28 lines
516 B
Go

package sww
import (
"net/url"
"testing"
)
func TestAppAddress(t *testing.T) {
t.Parallel()
for app, want := range map[string]string{
"http://127.0.0.1:8081": "127.0.0.1:8081",
"http://app": "app:80",
"https://app/": "app:443",
"https://[::1]": "[::1]:443",
} {
parsed, err := url.Parse(app)
if err != nil {
t.Fatalf("parse %q: %v", app, err)
}
got := appAddress(parsed)
if got != want {
t.Errorf("appAddress(%q) is %q, want %q", app, got, want)
}
}
}