Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: "Integration Tests"
on: # yamllint disable-line rule:truthy
push:
branches:
- "main"
pull_request:
branches:
- "*"
merge_group:
types:
- "checks_requested"
workflow_dispatch: # Allow manual triggering

env:
GO_VERSION: "~1.24.0"

jobs:
# Matrix job for individual integration tests
integration-tests:
name: "${{ matrix.test.name }}"
runs-on: "depot-ubuntu-24.04"
timeout-minutes: 30
strategy:
fail-fast: true # Cancel remaining tests if one fails
matrix:
test:
- name: "Cluster Creation"
command: "test:integrationRun"
pattern: "TestMultiNodeClusterCreation"
timeout: "15m"
- name: "Cluster Health"
command: "test:integrationRun"
pattern: "TestMultiNodeClusterHealth"
timeout: "20m"
- name: "Pool Functionality"
command: "test:integrationRun"
pattern: "TestMultiNodePoolFunctionality"
timeout: "25m"
- name: "Connection Balancing"
command: "test:integrationRun"
pattern: "TestMultiNodeConnectionBalancing"
timeout: "20m"
- name: "Error Handling"
command: "test:integrationRun"
pattern: "TestMultiNodeErrorHandling"
timeout: "15m"

steps:
- uses: "actions/checkout@v4"
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"

- name: "Run ${{ matrix.test.name }} Test"
run: |
echo "Running integration test: ${{ matrix.test.name }}"
echo "Command: go run mage.go ${{ matrix.test.command }} \"${{ matrix.test.pattern }}\""
timeout "${{ matrix.test.timeout }}" go run mage.go ${{ matrix.test.command }} "${{ matrix.test.pattern }}"

- name: "Collect container logs on failure"
if: "failure()"
run: |
echo "=== Docker System Info ==="
docker system df || true
echo "=== Running Containers ==="
docker ps -a || true
echo "=== Docker Networks ==="
docker network ls || true
echo "=== Recent Container Logs ==="
docker ps -a --format "table {{.Names}}\t{{.Status}}" | grep -E "(crdb|cockroach|testcontainers)" | head -5 || true
continue-on-error: true
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: "Lint"
on: # yamllint disable-line rule:truthy
on: # yamllint disable-line rule:truthy
push:
branches:
- "!dependabot/*"
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: "Build & Test"
on: # yamllint disable-line rule:truthy
on: # yamllint disable-line rule:truthy
push:
branches:
- "main"
Expand All @@ -14,12 +14,27 @@ env:
GO_VERSION: "~1.24.0"
jobs:
unit:
name: "Unit"
runs-on: "ubuntu-latest"
name: "Unit Tests"
runs-on: "depot-ubuntu-24.04"
steps:
- uses: "actions/checkout@v3"
- uses: "actions/checkout@v4"
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"
- name: "Unit tests"
run: "go run mage.go test:unit"

# Build validation
build:
name: "Build"
runs-on: "depot-ubuntu-24.04"
needs: "unit"
steps:
- uses: "actions/checkout@v4"
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"
- name: "Build"
run: "go build ./..."
- name: "Vet"
run: "go vet ./..."
91 changes: 41 additions & 50 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,69 +1,60 @@
---
version: 2

run:
timeout: '5m'
timeout: "5m"

output:
sort-results: true

linters-settings:
goimports:
local-prefixes: 'github.com/authzed/crdbpool'
rowserrcheck:
packages:
- 'github.com/jackc/pgx'
gosec:
excludes:
- 'G404' # Allow the usage of math/rand
- "G404" # Allow the usage of math/rand
rowserrcheck:
packages:
- "github.com/jackc/pgx"

linters:
enable:
- 'bidichk'
- 'bodyclose'
- 'errcheck'
- 'errname'
- 'errorlint'
- 'gofumpt'
- 'goimports'
- 'goprintffuncname'
- 'gosec'
- 'gosimple'
- 'govet'
- 'importas'
- 'ineffassign'
- 'makezero'
- 'prealloc'
- 'predeclared'
- 'promlinter'
- 'revive'
- 'rowserrcheck'
- 'staticcheck'
- 'stylecheck'
- 'tenv'
- 'typecheck'
- 'unconvert'
- 'unused'
- 'wastedassign'
- 'whitespace'
- "errcheck"
- "govet"
- "ineffassign"
- "staticcheck"
- "unused"
- "bodyclose"
- "gosec"
- "revive"
- "rowserrcheck"
- "errorlint"
- "gocritic"
- "unconvert"
- "wastedassign"
- "whitespace"
- "importas"
- "prealloc"
- "predeclared"
- "bidichk"

issues:
exclude-rules:
- text: 'tx.Rollback()'
- text: "tx.Rollback()"
linters:
- 'errcheck'
- "errcheck"
# NOTE: temporarily disable deprecation checks for v0.
- path: 'internal/services/'
linters:
- 'staticcheck'
text: 'SA1019'
- path: 'internal/middleware/consistency/'
- path: "internal/services/"
linters:
- 'staticcheck'
text: 'SA1019'
- path: 'pkg/proto/core/v1/core.pb.validate.manual.go' # Ignore manual definition of metadata map
- "staticcheck"
text: "SA1019"
- path: "internal/middleware/consistency/"
linters:
- 'stylecheck'
text: 'ST1003'
- path: 'pkg/proto/core/v1/core.pb.validate.manual.go' # Ignore manual definition of metadata map
- "staticcheck"
text: "SA1019"
- path: "pkg/proto/core/v1/core.pb.validate.manual.go" # Ignore manual definition of metadata map
linters:
- 'revive'
text: 'var-naming'
- "revive"
text: "ST1003|var-naming"
# Ignore receiver errors for generic types not understood by the linter.
- linters:
- 'revive'
- "revive"
text: 'receiver-naming: receiver name \S+ should be consistent with previous receiver name \S+ for invalid-type'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[![Go Report Card](https://goreportcard.com/badge/github.com/authzed/crdbpool)](https://goreportcard.com/report/github.com/authzed/crdbpool)
[![GoDoc](https://pkg.go.dev/badge/s.svg)](https://pkg.go.dev/github.com/authzed/crdbpool)
[![Build & Test](https://github.com/authzed/crdbpool/actions/workflows/test.yaml/badge.svg)](https://github.com/authzed/crdbpool/actions/workflows/test.yaml)
[![Integration Tests](https://github.com/authzed/crdbpool/actions/workflows/integration.yaml/badge.svg)](https://github.com/authzed/crdbpool/actions/workflows/integration.yaml)

`crdbpool` implements a node-aware connection pool for [CockroachDB] by wrapping [pgx].

Expand Down
45 changes: 45 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,74 @@ require (
github.com/prometheus/client_golang v1.22.0
github.com/rs/zerolog v1.34.0
github.com/stretchr/testify v1.10.0
github.com/testcontainers/testcontainers-go v0.38.0
golang.org/x/sync v0.15.0
golang.org/x/time v0.12.0
google.golang.org/grpc v1.73.0
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v28.2.2+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.8.4 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.1.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.64.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/shirou/gopsutil/v4 v4.25.5 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.36.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.36.0 // indirect
go.opentelemetry.io/otel/trace v1.36.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.33.0 // indirect
Expand Down
Loading
Loading