-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Fix flakiness in log rotation test #2213
Fix flakiness in log rotation test #2213
Conversation
4f5f0ab
to
0b3ba87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions, nothing biggie.
integration/log_rotation_test.go
Outdated
@@ -111,6 +120,13 @@ func (s *LogRotationSuite) TestTraefikLogRotation(c *check.C) { | |||
c.Assert(lineCount, checker.GreaterOrEqualThan, 7) | |||
} | |||
|
|||
func logAccessLogFile(c *check.C, fileName string) { | |||
output, err := ioutil.ReadFile(fileName) | |||
c.Assert(err, checker.IsNil, check.Commentf("error opening access log file %s: %s", fileName, err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR the error from ioutil.ReadFile
will already contain the file name and detailed error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I removed the Commentf
.
integration/log_rotation_test.go
Outdated
output, err := ioutil.ReadFile(fileName) | ||
c.Assert(err, checker.IsNil, check.Commentf("error opening access log file %s: %s", fileName, err)) | ||
c.Logf("Contents of file %s", fileName) | ||
c.Log(string(output)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also be part of the previous statement, separating the message "header" and the content by a newline (\n
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified it into one line 👍
@@ -111,6 +120,13 @@ func (s *LogRotationSuite) TestTraefikLogRotation(c *check.C) { | |||
c.Assert(lineCount, checker.GreaterOrEqualThan, 7) | |||
} | |||
|
|||
func logAccessLogFile(c *check.C, fileName string) { | |||
output, err := ioutil.ReadFile(fileName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a case of t.Helper()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of the integration tests we can not use it, as we don't have access to testing.T
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah -- sad and true.
@timoreimann thanks for the review, I incorporated the feedback. I am not sure though why Semaphore won't build this branch.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👏
I think 3s is too large: FYI we use a multiplier in the CI |
I close and reopen due to Semaphore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👏
- wait up to 3 seconds for the creation of the new log file after sending the signal to rotate the log files - improve logging output in case of failure
5e616b8
to
1f36ff0
Compare
This PR fixes #2203 by waiting up to 3 seconds until the new log file is created after the signal was sent to Traefik to rotate the log files. Also, it improves logging of the log file output in case something is not correct to ease the detection of potential other problems that were hidden before.