You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/12/03 00:09:47 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6366: T3C remove extraneous logs

ocket8888 commented on a change in pull request #6366:
URL: https://github.com/apache/trafficcontrol/pull/6366#discussion_r756284472



##########
File path: cache-config/testing/ort-tests/t3c-lockfile_test.go
##########
@@ -76,38 +74,36 @@ func TestLockfile(t *testing.T) {
 		}
 
 		if acquireStartLine == "" || acquireEndLine == "" {
-			t.Fatalf("t3c apply output expected to contain 'Trying to acquire app lock' and 'Acquired app lock', actual: '''%s'''", out)
+			t.Fatalf("t3c apply output expected to contain 'Trying to acquire app lock' and 'Acquired app lock', actual: %s", out)
 		}
 
-		acquireStart := parseLogLineTime(acquireStartLine)
-		if acquireStart == nil {
-			t.Fatalf("t3c apply acquire line failed to parse time, line '" + acquireStartLine + "'")
+		acquireStart, err := parseLogLineTime(acquireStartLine)
+		if acquireStart == nil || err != nil {
+			t.Fatalf("t3c apply acquire line failed to parse time, line '%s': %v", acquireStartLine, err)
 		}
-		acquireEnd := parseLogLineTime(acquireEndLine)
-		if acquireEnd == nil {
-			t.Fatalf("t3c apply acquire line failed to parse time, line '" + acquireEndLine + "'")
+		acquireEnd, err := parseLogLineTime(acquireEndLine)
+		if acquireEnd == nil || err != nil {
+			t.Fatalf("t3c apply acquire line failed to parse time, line '%s': %v", acquireEndLine, err)
 		}
 
 		minDiff := time.Second * 1 // checking the file lock should never take 1s, so that's enough to verify it was hit
 		if diff := acquireEnd.Sub(*acquireStart); diff < minDiff {
 			t.Fatalf("t3c apply expected time to acquire while another t3c is running to be at least %s, actual %s start line '%s' end line '%s'", minDiff, diff, acquireStartLine, acquireEndLine)
 		}
 
-		t.Logf(testName + " succeeded")
 	})
-	t.Logf("------------- End of " + testName + " ---------------")
 }
 
-func parseLogLineTime(line string) *time.Time {
+func parseLogLineTime(line string) (*time.Time, error) {

Review comment:
       I just think it helps with debugging to know why the parse failed, if it does. I can revert it if you want, though, the odds of that happening are probably pretty low, and/or in that case some more specific test is probably failing.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org