GitHub user DimaOshchepkov added a comment to the discussion: Discuss adding a
Docker-based workflow for running tests locally
We could add something similar to the readme or make the creation more
automated. What do you think of this idea?
## Local Test Container
You can run tests against a local checkout without installing build
dependencies on the host by using the published Cloudberry build image and a
bind mount. The source tree remains on the host, so edits made on the host or
inside the container affect the same files.
>From the repository root:
```bash
docker run -dit \
--privileged \
--user root \
--hostname cdw \
--name cloudberry-devtest \
--shm-size=2gb \
--ulimit core=-1 \
--cgroupns=host \
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
-v "$PWD":/workspace/cloudberry \
-w /workspace/cloudberry \
apache/incubator-cloudberry:cbdb-build-rocky9-latest \
bash -lc "sleep infinity"
```
Enter the container:
```bash
docker exec -it --user gpadmin -w /workspace/cloudberry cloudberry-devtest bash
```
Prepare the build and demo cluster inside the container:
```bash
export SRC_DIR=/workspace/cloudberry
export BUILD_DESTINATION=/usr/local/cloudberry-db
/tmp/init_system.sh
./devops/build/automation/cloudberry/scripts/configure-cloudberry.sh
./devops/build/automation/cloudberry/scripts/build-cloudberry.sh
./devops/build/automation/cloudberry/scripts/create-cloudberry-demo-cluster.sh
```
After changing code, rebuild the relevant parts or rerun the build script, then
run the tests you need. For example:
```bash
source /usr/local/cloudberry-db/cloudberry-env.sh
source /workspace/cloudberry/gpAux/gpdemo/gpdemo-env.sh
PGOPTIONS="-c optimizer=off" make -C src/test/regress installcheck-small
PGOPTIONS="-c optimizer=off" make -C src/test/regress installcheck-tests
TESTS="insert"
make -C src/test/isolation2 installcheck-isolation2
```
Stop or remove the container when it is no longer needed:
```bash
docker stop cloudberry-devtest
docker rm -f cloudberry-devtest
```
GitHub link:
https://github.com/apache/cloudberry/discussions/1682#discussioncomment-16670051
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]