diff --git a/integration/scenario.go b/integration/scenario.go index 801987afe45..eb215d6af35 100644 --- a/integration/scenario.go +++ b/integration/scenario.go @@ -220,10 +220,20 @@ func (s *Scenario) ShutdownAssertNoPanics(t *testing.T) { for userName, user := range s.users { for _, client := range user.Clients { log.Printf("removing client %s in user %s", client.Hostname(), userName) - err := client.Shutdown() + stdoutPath, stderrPath, err := client.Shutdown() if err != nil { log.Printf("failed to tear down client: %s", err) } + + if t != nil { + stdout, err := os.ReadFile(stdoutPath) + require.NoError(t, err) + assert.NotContains(t, string(stdout), "panic") + + stderr, err := os.ReadFile(stderrPath) + require.NoError(t, err) + assert.NotContains(t, string(stderr), "panic") + } } } diff --git a/integration/tailscale.go b/integration/tailscale.go index 66cc1ca3f9f..da9b8754a61 100644 --- a/integration/tailscale.go +++ b/integration/tailscale.go @@ -15,7 +15,7 @@ import ( // nolint type TailscaleClient interface { Hostname() string - Shutdown() error + Shutdown() (string, string, error) Version() string Execute( command []string, diff --git a/integration/tsic/tsic.go b/integration/tsic/tsic.go index 023cc430dc2..e63a7b6ecfd 100644 --- a/integration/tsic/tsic.go +++ b/integration/tsic/tsic.go @@ -236,11 +236,8 @@ func New( } tailscaleOptions := &dockertest.RunOptions{ - Name: hostname, - Networks: []*dockertest.Network{tsic.network}, - // Cmd: []string{ - // "tailscaled", "--tun=tsdev", - // }, + Name: hostname, + Networks: []*dockertest.Network{tsic.network}, Entrypoint: tsic.withEntrypoint, ExtraHosts: tsic.withExtraHosts, Env: []string{}, @@ -357,8 +354,8 @@ func New( } // Shutdown stops and cleans up the Tailscale container. -func (t *TailscaleInContainer) Shutdown() error { - err := t.SaveLog("/tmp/control") +func (t *TailscaleInContainer) Shutdown() (string, string, error) { + stdoutPath, stderrPath, err := t.SaveLog("/tmp/control") if err != nil { log.Printf( "Failed to save log from %s: %s", @@ -367,7 +364,7 @@ func (t *TailscaleInContainer) Shutdown() error { ) } - return t.pool.Purge(t.container) + return stdoutPath, stderrPath, t.pool.Purge(t.container) } // Hostname returns the hostname of the Tailscale instance. @@ -1099,15 +1096,14 @@ func (t *TailscaleInContainer) WriteFile(path string, data []byte) error { // SaveLog saves the current stdout log of the container to a path // on the host system. -func (t *TailscaleInContainer) SaveLog(path string) error { +func (t *TailscaleInContainer) SaveLog(path string) (string, string, error) { // TODO(kradalby): Assert if tailscale logs contains panics. // NOTE(enoperm): `t.WriteLog | countMatchingLines` // is probably most of what is for that, // but I'd rather not change the behaviour here, // as it may affect all the other tests // I have not otherwise touched. - _, _, err := dockertestutil.SaveLog(t.pool, t.container, path) - return err + return dockertestutil.SaveLog(t.pool, t.container, path) } // WriteLogs writes the current stdout/stderr log of the container to