Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include logs in test failure when TUF autoupdater doesn't shut down/restart within 5 seconds #1452

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/autoupdate/tuf/autoupdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestExecute_launcherUpdate(t *testing.T) {
shutdownDeadline := time.Now().Add(5 * time.Second).Unix()
for {
if time.Now().Unix() > shutdownDeadline {
t.Error("autoupdater did not shut down within 5 seconds")
t.Error("autoupdater did not shut down within 5 seconds -- logs: ", logBytes.String())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is going to be readable, or kind of a mess. I wonder about just copying it to os.Stderr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll definitely be a little messy, but it's hopefully not permanent! I don't think we'd see output if we copy to os.Stderr -- I find that output from tests tends to get swallowed in CI, and if I write something to os.Stderr in a test I don't see that output when running make test locally.

t.FailNow()
}

Expand Down Expand Up @@ -341,7 +341,7 @@ func TestExecute_downgrade(t *testing.T) {
shutdownDeadline := time.Now().Add(5 * time.Second).Unix()
for {
if time.Now().Unix() > shutdownDeadline {
t.Error("autoupdater did not restart osquery within 5 seconds")
t.Error("autoupdater did not restart osquery within 5 seconds -- logs: ", logBytes.String())
t.FailNow()
}

Expand Down
Loading