Merged in feature/parallellogqueries (pull request #132)

Testing Tweaks

* parallel

* slowestquery

* split

* cleanup

* health

* dynamiccores

* go

* profile

* timeout

* commitmychanges

* taskfile

* sqlcheckstart

* client

* cost

* ctxtimeout
This commit is contained in:
Michael McGuinness
2025-05-05 09:31:21 +00:00
parent 40061ee2e9
commit efe87321b2
76 changed files with 1238 additions and 1495 deletions
+5 -6
View File
@@ -4,24 +4,23 @@
version: "3"
vars:
CONTEXT: ..
OUT_DIR: out
includes:
test:
dir: "{{.CONTEXT}}"
dir: ".."
taskfile: tests.yml
docker:
dir: "."
dir: ".."
taskfile: docker.yml
openapi:
dir: "{{.CONTEXT}}"
dir: ".."
taskfile: openapi-scripts.yml
compose:
dir: "."
dir: ".."
taskfile: local-deployments.yml
db:
dir: "{{.CONTEXT}}"
dir: ".."
taskfile: database.yml
tasks:
+6 -4
View File
@@ -5,10 +5,12 @@ version: "3"
vars:
MIGRATIONS: "internal/database/migrations"
QUERIES: "internal/database/queries/"
CONFIG_FILE: "sqlc.yml"
includes:
compose:
dir: "{{.CONTEXT}}"
dir: ".."
taskfile: local-deployments.yml
internal: true
@@ -18,14 +20,14 @@ tasks:
cmds:
- task: compose:up:generate
- migrate -path {{.MIGRATIONS}} -database {{.DB_URI_GENERATE}} up
- sqlc generate --file sqlc.yml
- sqlc generate --file {{.CONFIG_FILE}}
lint:
cmds:
- task: compose:up:generate
- sqlc vet --file sqlc.yml
- sqlc vet --file {{.CONFIG_FILE}}
- |
exit 0
for file in internal/database/migrations/*.sql; do
for file in {{.MIGRATIONS}}/*.sql; do
if [[ -f "$file" ]]; then
sqlcheck -c -f $file -r 3 # move to 1
fi
+2 -2
View File
@@ -4,7 +4,7 @@
version: "3"
vars:
DOCKERFILE: "{{.CONTEXT}}/build/Dockerfile"
DOCKERFILE: "build/Dockerfile"
tasks:
lint:
@@ -13,4 +13,4 @@ tasks:
build:
run: once
cmds:
- docker build -t {{.IMAGE_NAME}} -f {{.DOCKERFILE}} {{.CONTEXT}}
- docker build -t {{.IMAGE_NAME}} -f {{.DOCKERFILE}} .
+4 -4
View File
@@ -4,10 +4,10 @@
version: "3"
vars:
LOCAL_COMPOSE_FILE: "{{.CONTEXT}}/deployments/compose.local.yaml"
TEST_COMPOSE_FILE: "{{.CONTEXT}}/deployments/compose.test.yaml"
GENERATE_COMPOSE_FILE: "{{.CONTEXT}}/deployments/compose.generate.yaml"
AWS_COMPOSE_FILE: "{{.CONTEXT}}/deployments/compose.aws.yaml"
LOCAL_COMPOSE_FILE: "deployments/compose.local.yaml"
TEST_COMPOSE_FILE: "deployments/compose.test.yaml"
GENERATE_COMPOSE_FILE: "deployments/compose.generate.yaml"
AWS_COMPOSE_FILE: "deployments/compose.aws.yaml"
tasks:
build:test:
+18 -3
View File
@@ -10,7 +10,22 @@ vars:
API: "./api/..."
PKG: "./pkg/..."
CMD: "./cmd/..."
TEST_PARALLEL: 32
CPU_COUNT:
sh: |
# First try nproc (Linux)
if command -v nproc >/dev/null 2>&1; then
nproc
# Fall back to sysctl (macOS)
elif [ "$(uname)" = "Darwin" ]; then
sysctl -n hw.ncpu
# Fall back to Windows approach
elif [ "$(uname)" = "Windows" ] || [ "$(uname)" = "MINGW"* ]; then
echo "$NUMBER_OF_PROCESSORS"
else
echo "4" # Default fallback value
fi
TEST_PARALLEL:
sh: echo $(( {{.CPU_COUNT}} * 2))
# yamllint disable-line rule:line-length
EXCLUDED_FILES: ".gen.go|internal/serviceconfig/observability/prometheus/generator/main.go|internal/cognitoauth/middleware.go|internal/cognitoauth/token.go|internal/cognitoauth/auth.go|internal/cognitoauth/handler.go|internal/cognitoauth/models.go|api/queryAPI/authHandlers.go|api/queryAPI/homehandler.go"
@@ -19,12 +34,12 @@ tasks:
run: once
cmds:
- rm -rf mocks/*
- go tool mockery
- go tool mockery --log-level=""
functional:
cmds:
- mkdir -p {{.OUT_DIR}}
- |
go test -count=1 -parallel {{.TEST_PARALLEL}} \
GOMAXPROCS={{.TEST_PARALLEL}} go test -count=1 -parallel {{.CPU_COUNT}} \
-coverpkg={{.INTERNAL}},{{.API}},{{.PKG}} \
-coverprofile={{.COVERAGE_FILE}} \
./...