阶段2(下):运维专题 Docker/Nginx/Linux/CI-CD/Git 的课程、企业场景、面试题和可运行示例

This commit is contained in:
Shikui Wang committed 2026-10-23 15:36:06 +08:00
1 parent 5eb67c5d08
commit b8010a74f3
42 files changed
+3533 -55

No files matched your search

@@ -0,0 +1,22 @@
package main
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestRoutes(t *testing.T) {
srv := httptest.NewServer(newMux())
defer srv.Close()
for path, want := range map[string]int{"/healthz": 200, "/api/hello": 200, "/nope": 404} {
resp, err := http.Get(srv.URL + path)
if err != nil {
t.Fatal(err)
}
resp.Body.Close()
if resp.StatusCode != want {
t.Errorf("%s = %d, want %d", path, resp.StatusCode, want)
}
}
}