check / check (push) Failing after 3s
The Dockerfile's last stage is now the image of "Deployment" in SPEC.md: Ubuntu 26.04 with ca-certificates, nix-bin and runit from a dated snapshot whose InRelease files are checked by hash, nixpkgs from its release file checked by SHA-256, runsvinit built at a fixed commit, and smallwebwaf as a runit service. smallwebwaf answers /_smallwebwaf/healthz, and `smallwebwaf healthcheck` is the image's HEALTHCHECK. script/example-app builds an app on the image and checks it end to end. The Nix profile comes last on the PATH: first, busybox from nixpkgs replaced runit's own runsvdir and sv. SPEC.md is corrected to match what was built. Model: opus-5-5
28 lines
524 B
Go
28 lines
524 B
Go
package smallwebwaf
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|