Skip to content

Commit b51131c

Browse files
authored
Merge branch 'main' into chore/chart-user-configs
2 parents b5436dd + 9f12d79 commit b51131c

36 files changed

+3513
-659
lines changed

.circleci/pgcat.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ admin_password = "admin_pass"
5959
# session: one server connection per connected client
6060
# transaction: one server connection per client transaction
6161
pool_mode = "transaction"
62+
prepared_statements_cache_size = 500
6263

6364
# If the client doesn't specify, route traffic to
6465
# this role by default.
@@ -141,6 +142,7 @@ query_parser_enabled = true
141142
query_parser_read_write_splitting = true
142143
primary_reads_enabled = true
143144
sharding_function = "pg_bigint_hash"
145+
prepared_statements_cache_size = 500
144146

145147
[pools.simple_db.users.0]
146148
username = "simple_user"

.circleci/run_tests.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ PGPASSWORD=sharding_user pgbench -h 127.0.0.1 -U sharding_user shard1 -i
2626
PGPASSWORD=sharding_user pgbench -h 127.0.0.1 -U sharding_user shard2 -i
2727

2828
# Start Toxiproxy
29+
kill -9 $(pgrep toxiproxy) || true
2930
LOG_LEVEL=error toxiproxy-server &
3031
sleep 1
3132

@@ -106,7 +107,7 @@ cd ../..
106107
# These tests will start and stop the pgcat server so it will need to be restarted after the tests
107108
#
108109
pip3 install -r tests/python/requirements.txt
109-
python3 tests/python/tests.py || exit 1
110+
pytest || exit 1
110111

111112

112113
#
@@ -177,3 +178,6 @@ killall pgcat -s SIGINT
177178

178179
# Allow for graceful shutdown
179180
sleep 1
181+
182+
kill -9 $(pgrep toxiproxy)
183+
sleep 1

.github/workflows/build-and-push.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ jobs:
2323

2424
steps:
2525
- name: Checkout Repository
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
2730

2831
- name: Set up Docker Buildx
29-
uses: docker/setup-buildx-action@v2
32+
uses: docker/setup-buildx-action@v3
3033

3134
- name: Determine tags
3235
id: metadata
33-
uses: docker/metadata-action@v4
36+
uses: docker/metadata-action@v5
3437
with:
3538
images: ${{ env.registry }}/${{ env.image-name }}
3639
tags: |
@@ -42,15 +45,18 @@ jobs:
4245
type=raw,value=latest,enable={{ is_default_branch }}
4346
4447
- name: Log in to the Container registry
45-
uses: docker/login-action@v2.1.0
48+
uses: docker/login-action@v3
4649
with:
4750
registry: ${{ env.registry }}
4851
username: ${{ github.actor }}
4952
password: ${{ secrets.GITHUB_TOKEN }}
5053

5154
- name: Build and push ${{ env.image-name }}
52-
uses: docker/build-push-action@v3
55+
uses: docker/build-push-action@v6
5356
with:
57+
context: .
58+
platforms: linux/amd64,linux/arm64
59+
provenance: false
5460
push: true
5561
tags: ${{ steps.metadata.outputs.tags }}
5662
labels: ${{ steps.metadata.outputs.labels }}

.github/workflows/chart-lint-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
2323
# yamllint (https://github.com/adrienverge/yamllint) which require Python
2424
- name: Set up Python
25-
uses: actions/setup-python@v4.1.0
25+
uses: actions/setup-python@v5.1.0
2626
with:
2727
python-version: 3.7
2828

@@ -43,7 +43,7 @@ jobs:
4343
run: ct lint --config ct.yaml
4444

4545
- name: Create kind cluster
46-
uses: helm/kind-action@v1.7.0
46+
uses: helm/kind-action@v1.10.0
4747
if: steps.list-changed.outputs.changed == 'true'
4848

4949
- name: Run chart-testing (install)

.github/workflows/chart-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
version: v3.13.0
3333

3434
- name: Run chart-releaser
35-
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0
35+
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
3636
with:
3737
charts_dir: charts
3838
config: cr.yaml

.github/workflows/publish-deb-package.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: pgcat package (deb)
22

33
on:
4+
push:
5+
tags:
6+
- v*
47
workflow_dispatch:
58
inputs:
69
packageVersion:
@@ -16,6 +19,14 @@ jobs:
1619
runs-on: ${{ matrix.os }}
1720
steps:
1821
- uses: actions/checkout@v3
22+
- name: Set package version
23+
if: github.event_name == 'push' # For push event
24+
run: |
25+
TAG=${{ github.ref_name }}
26+
echo "packageVersion=${TAG#v}" >> "$GITHUB_ENV"
27+
- name: Set package version (manual dispatch)
28+
if: github.event_name == 'workflow_dispatch' # For manual dispatch
29+
run: echo "packageVersion=${{ github.event.inputs.packageVersion }}" >> "$GITHUB_ENV"
1930
- uses: actions-rs/toolchain@v1
2031
with:
2132
toolchain: stable
@@ -39,10 +50,10 @@ jobs:
3950
export ARCH=arm64
4051
fi
4152
42-
bash utilities/deb.sh ${{ inputs.packageVersion }}
53+
bash utilities/deb.sh ${{ env.packageVersion }}
4354
4455
deb-s3 upload \
4556
--lock \
4657
--bucket apt.postgresml.org \
47-
pgcat-${{ inputs.packageVersion }}-ubuntu22.04-${ARCH}.deb \
58+
pgcat-${{ env.packageVersion }}-ubuntu22.04-${ARCH}.deb \
4859
--codename $(lsb_release -cs)

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ lcov.info
1010
dev/.bash_history
1111
dev/cache
1212
!dev/cache/.keepme
13-
.venv
13+
.venv
14+
**/__pycache__

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@ Thank you for contributing! Just a few tips here:
66
2. Run the test suite (e.g. `pgbench`) to make sure everything still works. The tests are in `.circleci/run_tests.sh`.
77
3. Performance is important, make sure there are no regressions in your branch vs. `main`.
88

9+
## How to run the integration tests locally and iterate on them
10+
We have integration tests written in Ruby, Python, Go and Rust.
11+
Below are the steps to run them in a developer-friendly way that allows iterating and quick turnaround.
12+
Hear me out, this should be easy, it will involve opening a shell into a container with all the necessary dependancies available for you and you can modify the test code and immediately rerun your test in the interactive shell.
13+
14+
15+
Quite simply, make sure you have docker installed and then run
16+
`./start_test_env.sh`
17+
18+
That is it!
19+
20+
Within this test environment you can modify the file in your favorite IDE and rerun the tests without having to bootstrap the entire environment again.
21+
22+
Once the environment is ready, you can run the tests by running
23+
Ruby: `cd /app/tests/ruby && bundle exec ruby <test_name>.rb --format documentation`
24+
Python: `cd /app/ && pytest`
25+
Rust: `cd /app/tests/rust && cargo run`
26+
Go: `cd /app/tests/go && /usr/local/go/bin/go test`
27+
28+
You can also rebuild PgCat directly within the environment and the tests will run against the newly built binary
29+
To rebuild PgCat, just run `cargo build` within the container under `/app`
30+
31+
![Animated gif showing how to run tests](https://github.com/user-attachments/assets/2258fde3-2aed-4efb-bdc5-e4f12dcd4d33)
32+
33+
34+
935
Happy hacking!
1036

1137
## TODOs

0 commit comments

Comments
 (0)