mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-13 13:21:27 +01:00
tstest/integration: log all the output printed by tailscale up
Updates tailscale/corp#31476 Updates #17361 Signed-off-by: Alex Chan <alexc@tailscale.com>
This commit is contained in:
parent
06f12186d9
commit
bb6bd46570
@ -1098,6 +1098,7 @@ func (tt *trafficTrap) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type authURLParserWriter struct {
|
type authURLParserWriter struct {
|
||||||
|
t *testing.T
|
||||||
buf bytes.Buffer
|
buf bytes.Buffer
|
||||||
// Handle login URLs, and count how many times they were seen
|
// Handle login URLs, and count how many times they were seen
|
||||||
authURLFn func(urlStr string) error
|
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]`)
|
var deviceApprovalURLRx = regexp.MustCompile(`(https?://\S+/admin)[^\S]`)
|
||||||
|
|
||||||
func (w *authURLParserWriter) Write(p []byte) (n int, err error) {
|
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)
|
n, err = w.buf.Write(p)
|
||||||
|
|
||||||
defer w.buf.Reset() // so it's not matched again
|
defer w.buf.Reset() // so it's not matched again
|
||||||
|
|||||||
@ -477,7 +477,7 @@ func TestOneNodeUpAuth(t *testing.T) {
|
|||||||
var authURLCount atomic.Int32
|
var authURLCount atomic.Int32
|
||||||
var deviceApprovalURLCount atomic.Int32
|
var deviceApprovalURLCount atomic.Int32
|
||||||
|
|
||||||
handler := &authURLParserWriter{
|
handler := &authURLParserWriter{t: t,
|
||||||
authURLFn: completeLogin(t, env.Control, &authURLCount),
|
authURLFn: completeLogin(t, env.Control, &authURLCount),
|
||||||
deviceApprovalURLFn: completeDeviceApproval(t, n1, &deviceApprovalURLCount),
|
deviceApprovalURLFn: completeDeviceApproval(t, n1, &deviceApprovalURLCount),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user