@@ -32,6 +32,7 @@ import (
32
32
"path"
33
33
"path/filepath"
34
34
"regexp"
35
+ "runtime/debug"
35
36
"sort"
36
37
"strconv"
37
38
"strings"
@@ -1359,16 +1360,28 @@ func RandomSuffix() string {
1359
1360
1360
1361
// ExpectEqual expects the specified two are the same, otherwise an exception raises
1361
1362
func ExpectEqual (actual interface {}, extra interface {}, explain ... interface {}) {
1363
+ if isEqual , _ := gomega .Equal (extra ).Match (actual ); ! isEqual {
1364
+ e2elog .Logf ("Unexpected unequal occurred: %v and %v" , actual , extra )
1365
+ debug .PrintStack ()
1366
+ }
1362
1367
gomega .Expect (actual ).To (gomega .Equal (extra ), explain ... )
1363
1368
}
1364
1369
1365
1370
// ExpectNotEqual expects the specified two are not the same, otherwise an exception raises
1366
1371
func ExpectNotEqual (actual interface {}, extra interface {}, explain ... interface {}) {
1372
+ if isEqual , _ := gomega .Equal (extra ).Match (actual ); isEqual {
1373
+ e2elog .Logf ("Expect to be unequal: %v and %v" , actual , extra )
1374
+ debug .PrintStack ()
1375
+ }
1367
1376
gomega .Expect (actual ).NotTo (gomega .Equal (extra ), explain ... )
1368
1377
}
1369
1378
1370
1379
// ExpectError expects an error happens, otherwise an exception raises
1371
1380
func ExpectError (err error , explain ... interface {}) {
1381
+ if err == nil {
1382
+ e2elog .Logf ("Expect error to occur." )
1383
+ debug .PrintStack ()
1384
+ }
1372
1385
gomega .Expect (err ).To (gomega .HaveOccurred (), explain ... )
1373
1386
}
1374
1387
@@ -1382,6 +1395,7 @@ func ExpectNoError(err error, explain ...interface{}) {
1382
1395
func ExpectNoErrorWithOffset (offset int , err error , explain ... interface {}) {
1383
1396
if err != nil {
1384
1397
e2elog .Logf ("Unexpected error occurred: %v" , err )
1398
+ debug .PrintStack ()
1385
1399
}
1386
1400
gomega .ExpectWithOffset (1 + offset , err ).NotTo (gomega .HaveOccurred (), explain ... )
1387
1401
}
@@ -1396,6 +1410,9 @@ func ExpectNoErrorWithRetries(fn func() error, maxRetries int, explain ...interf
1396
1410
}
1397
1411
e2elog .Logf ("(Attempt %d of %d) Unexpected error occurred: %v" , i + 1 , maxRetries , err )
1398
1412
}
1413
+ if err != nil {
1414
+ debug .PrintStack ()
1415
+ }
1399
1416
gomega .ExpectWithOffset (1 , err ).NotTo (gomega .HaveOccurred (), explain ... )
1400
1417
}
1401
1418
0 commit comments