Skip to content

Commit 4853cc9

Browse files
authored
Some more debugging for a test which was unstable. (#214)
* A bit more debugging.
1 parent d8a192f commit 4853cc9

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ go 1.12
44

55
require (
66
github.com/arangodb/go-velocypack v0.0.0-20190129082528-7896a965b4ad
7+
github.com/coreos/go-iptables v0.4.3
78
github.com/dgrijalva/jwt-go v3.2.0+incompatible
9+
github.com/pkg/errors v0.8.1
810
)

go.sum

+7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
github.com/arangodb/go-velocypack v0.0.0-20190129082528-7896a965b4ad h1:Ah+VRYUWLuqgbfnDyuC8IrIe8XFzpt9tBVVnPGFNTJ8=
22
github.com/arangodb/go-velocypack v0.0.0-20190129082528-7896a965b4ad/go.mod h1:7QCjpWXdB49P6fql1CxmsBWd8z/T4L4pqFLTnc10xNM=
3+
github.com/coreos/go-iptables v0.4.3 h1:jJg1aFuhCqWbgBl1VTqgTHG5faPM60A5JDMjQ2HYv+A=
4+
github.com/coreos/go-iptables v0.4.3/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
5+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
36
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
47
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
58
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
9+
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
10+
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
11+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
612
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13+
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
714
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=

test/backup_test.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import (
3333
"time"
3434

3535
driver "github.com/arangodb/go-driver"
36+
37+
errors "github.com/pkg/errors"
3638
)
3739

3840
var backupAPIAvailable *bool
@@ -341,24 +343,32 @@ func waitForServerRestart(ctx context.Context, c driver.Client, t *testing.T) {
341343

342344
serverWasDown := false
343345

346+
saveDriver := driver.WithStack
347+
driver.WithStack = errors.WithStack
348+
344349
for {
345350
vctx, cancel := context.WithTimeout(ctx, 50*time.Millisecond)
346351
if _, err := c.Version(vctx); err != nil {
347-
if driver.IsTimeout(err) {
348-
serverWasDown = true
349-
}
352+
fmt.Printf("Error Response: %v\n", err)
353+
fmt.Printf("Error Response: %+v\n", err)
354+
serverWasDown = true
350355
} else {
351356
if serverWasDown {
357+
fmt.Print("Leaving successfully\n")
352358
cancel()
359+
driver.WithStack = saveDriver
353360
return
354361
}
355362
}
356363

357364
cancel()
358365
select {
359366
case <-ctx.Done():
367+
fmt.Print("Context cancelled\n")
368+
driver.WithStack = saveDriver
360369
return
361370
case <-time.After(1 * time.Second):
371+
//fmt.Print("After 1 second\n")
362372
break
363373
}
364374
}

0 commit comments

Comments
 (0)