mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
logtail: start a local server for TestFastShutdown
Right now TestFastShutdown tries to upload logs to localhost:1234, which will most likely respond with an error. However if one has an actual service running on port 1234, it would receive a connection attempting to POST every time the unit test runs. Start a local server and direct the upload there instead. Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:
parent
2e9728023b
commit
b771a1363b
@ -16,8 +16,12 @@ func TestFastShutdown(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
testServ := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {}))
|
||||
defer testServ.Close()
|
||||
|
||||
l := NewLogger(Config{
|
||||
BaseURL: "http://localhost:1234",
|
||||
BaseURL: testServ.URL,
|
||||
}, t.Logf)
|
||||
l.Shutdown(ctx)
|
||||
}
|
||||
@ -30,6 +34,7 @@ func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
uploads += 1
|
||||
}))
|
||||
defer testServ.Close()
|
||||
|
||||
l := NewLogger(Config{BaseURL: testServ.URL}, t.Logf)
|
||||
for i := 1; i < 10; i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user