4
4
"context"
5
5
"fmt"
6
6
"os"
7
- "runtime"
8
7
"strings"
9
8
"testing"
10
9
"time"
@@ -27,20 +26,12 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
27
26
28
27
var errorsDetected = false
29
28
var p = func (format string , args ... interface {}) {
30
- _ , filename , line , _ := runtime .Caller (1 )
31
- format = "%s:%d [%s][TIMEOUT-CONFIGS] " + format + "\n "
32
- ts := time .Now ().Format ("15:04:05.000" )
33
- args = append ([]interface {}{filename , line , ts }, args ... )
34
- fmt .Printf (format , args ... )
29
+ printLog ("TIMEOUT-CONFIGS" , false , format , args ... )
35
30
}
36
31
37
32
var e = func (format string , args ... interface {}) {
38
33
errorsDetected = true
39
- _ , filename , line , _ := runtime .Caller (1 )
40
- format = "%s:%d [%s][TIMEOUT-CONFIGS][ERROR] " + format + "\n "
41
- ts := time .Now ().Format ("15:04:05.000" )
42
- args = append ([]interface {}{filename , line , ts }, args ... )
43
- fmt .Printf (format , args ... )
34
+ printLog ("TIMEOUT-CONFIGS" , true , format , args ... )
44
35
}
45
36
46
37
// Test different timeout configurations
@@ -109,10 +100,8 @@ func TestTimeoutConfigurationsPushNotifications(t *testing.T) {
109
100
t .Run (timeoutTest .name , func (t * testing.T ) {
110
101
errorsDetected = false
111
102
var ef = func (format string , args ... interface {}) {
112
- format = "[%s][TIMEOUT-CONFIGS][ERROR] " + format
113
- ts := time .Now ().Format ("15:04:05.000" )
114
- args = append ([]interface {}{ts }, args ... )
115
- t .Fatalf (format , args ... )
103
+ printLog ("TIMEOUT-CONFIGS" , true , format , args ... )
104
+ t .FailNow ()
116
105
}
117
106
118
107
p ("Testing timeout configuration: %s - %s" , timeoutTest .name , timeoutTest .description )
0 commit comments