Prerequisites¶
Golang 1.24.3¶
Mac:¶
Ubuntu:¶
apt-get update
wget https://go.dev/dl/go1.24.3.linux-amd64.tar.gz
tar xvf ./go1.24.3.linux-amd64.tar.gz
rm ./go1.24.3.linux-amd64.tar.gz
mv ./go/ /usr/local/
Add the following lines in ~/.profile:
Test the version:
Docker client¶
Mac:¶
To enable network connectivity to Docker containers from macOS, run the following commands:
If you’re still experiencing issues, try restarting the service with the following command:
Ubuntu:¶
Follow instructions here
To grant access to a non-root user:
Quickstart¶
Build¶
You can build locally or via a docker.
Local build:
Docker build:
Build linux binaries for remote machines:
Test¶
To execute the tests, use:
Race Detection¶
The project uses Go's race detector to catch data race conditions during test execution. Race detection is:
- Enabled by default in CI and local development for unit tests (test-no-db, test-all-db)
- Not enabled for integration and container tests to avoid excessive slowdown
Golang Development Dependencies Installation¶
Note on Database Requirements¶
In some tests, a DB is required (YugabyteDB or PostgreSQL 18+).
The test harness will either create a YugabyteDB Docker instance or reuse an existing instance.
Therefore, the test harness will not shut down the DB container between tests.
Once you no longer intend to run tests, you can stop the container using make kill-test-docker.
It is possible to use your own YugabyteDB instance by setting the following environment variable: DB_DEPLOYMENT=local.
This will instruct the test harness to connect to your local DB instance at port 5433, rather than creating any Docker instance.
YugabyteDB's quick start guide offers more information on how to install and run the database locally.
PostgreSQL Support: The project supports PostgreSQL 18 or later. Docker images use postgres:18.3-alpine3.23.
Example: Start Yugabyte via docker
docker run --name sc_yugabyte_unit_tests \
--platform linux/amd64 \
-p 5433:5433 \
-d yugabytedb/yugabyte:2025.2.0.1-b1 \
bin/yugabyted start \
--background=false \
--advertise_address=0.0.0.0 \
--callhome=false \
--fault_tolerance=none \
--ui=false \
--tserver_flags=ysql_max_connections=5000 \
--insecure