I am writing a script for my Couchbase deployment that I have to test. Writing the tests requires destroying and recreating a local cluster a few times.
The script uses at some point a few n1ql queries (using the Go SDK) to manage indexes. However, the test randomly fails on this step with a “service not available” error. This is especially problematic because it occurs randomly on around half of the tests.
I have confirmed the error comes from the following instruction:
res, err := cluster.Query("SELECT * FROM system:indexes", &gocb.QueryOptions{Timeout: 60 * time.Second})
Which is by the way the only moment I user the Query method in my whole scripts.
I noticed the error rarely occurs on first run, and became less present when adding a long cooldown after destroying the cluster (I didn’t got significantly better results above a 60 seconds cooldown, which still make the test fails quite a few times).
Is their a solution to ensure the Couchbase Server app is totally shutdown and can be safely restarted ? Or any other way to prevent this failure from happening ?
My environment :
- macOS Big Sur 11.1
- Couchbase Server Community Edition 6.6.0-7909 (app, not Docker)
- Go SDK 2.2 with Go 1.15
- Single Cluster