Testing for Couchbase Server startup via REST API


#1

We’re currently using bash scripts to initialize single server Couchbase clusters inside Docker containers for our development machines. The script starts up Couchbase Server, initializes the configuration, creates buckets, and populates them with test data. However, we’re seeing sporadic issues with filling the buckets with sample data that seems to be related to timing.

Currently, we’re monitoring the REST API and waiting for all buckets to show a status of “healthy” before we begin posting test data via the K/V API. You can see the bash script we’re using here: https://github.com/brantburnett/couchbasefakeit/blob/master/configure-node.sh#L60

However, sporadically we’ll get this error from the NodeJS SDK (being used by FakeIt):
(node:473) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CouchbaseError: Client-Side timeout exceeded for operation. Inspect network conditions or increase the timeout

This error usually happens on the first bucket we’re loading with data, but not always. It also doesn’t happen consistently. This operation is 100% on the local machine, and the bash script is executing within the same Docker container where Couchbase Server is running.

I’ve tried adding an extra “sleep 1” after we see the buckets as healthy, but it doesn’t seem to have consistently resolved the problem.

Any ideas? Is there a better REST endpoint we can check to be sure the server is ready for K/V operations after startup?

Thanks,
Brant


#2

Unfortunately, much of this is asynchronous inside the cluster and it does not provide an interface to determine when many things are ready. This includes a bucket coming up. The ‘hack’ I have heard of is crafting requests against each vbucket and looping until they’re all up, but that’s not even reliable for all services.

This is a variation on MB-11484. You may want to comment there and/or open an issue.


#3

@ingenthr

Thanks, I’d seen that issue the other day and should have connected the dots. I’ll just increase my sleep timer a bit and see if that helps for now.

Brant