Ver código fonte

tstest/integration: log all the output printed by `tailscale up`

Updates tailscale/corp#31476
Updates #17361

Signed-off-by: Alex Chan <[email protected]>
Alex Chan 5 meses atrás
pai
commit
bb6bd46570

+ 3 - 0
tstest/integration/integration.go

@@ -1098,6 +1098,7 @@ func (tt *trafficTrap) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 }
 
 type authURLParserWriter struct {
+	t   *testing.T
 	buf bytes.Buffer
 	// Handle login URLs, and count how many times they were seen
 	authURLFn func(urlStr string) error
@@ -1114,6 +1115,8 @@ var authURLRx = regexp.MustCompile(`(https?://\S+/auth/\S+)`)
 var deviceApprovalURLRx = regexp.MustCompile(`(https?://\S+/admin)[^\S]`)
 
 func (w *authURLParserWriter) Write(p []byte) (n int, err error) {
+	w.t.Helper()
+	w.t.Logf("received bytes: %s", string(p))
 	n, err = w.buf.Write(p)
 
 	defer w.buf.Reset() // so it's not matched again

+ 1 - 1
tstest/integration/integration_test.go

@@ -477,7 +477,7 @@ func TestOneNodeUpAuth(t *testing.T) {
 					var authURLCount atomic.Int32
 					var deviceApprovalURLCount atomic.Int32
 
-					handler := &authURLParserWriter{
+					handler := &authURLParserWriter{t: t,
 						authURLFn:           completeLogin(t, env.Control, &authURLCount),
 						deviceApprovalURLFn: completeDeviceApproval(t, n1, &deviceApprovalURLCount),
 					}