mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-26 18:36:28 +00:00
tests
This commit is contained in:
@@ -15,28 +15,28 @@ jobs:
|
|||||||
username: mydockerhub-user
|
username: mydockerhub-user
|
||||||
password: $DOCKERHUB_PASSWORD
|
password: $DOCKERHUB_PASSWORD
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: sharding_user
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_DB: shard0
|
POSTGRES_DB: postgres
|
||||||
# Add steps to the job
|
# Add steps to the job
|
||||||
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
|
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: cargo-lock-3-{{ checksum "Cargo.lock" }}
|
key: cargo-lock-2-{{ checksum "Cargo.lock" }}
|
||||||
- run:
|
- run:
|
||||||
name: "Install dependencies"
|
name: "Install dependencies"
|
||||||
command: "sudo apt-get update && sudo apt-get install -y postgresql-contrib-12 postgresql-client-12"
|
command: "sudo apt-get update && sudo apt-get install -y postgresql-contrib-12 postgresql-client-12"
|
||||||
- run:
|
- run:
|
||||||
name: "Build"
|
name: "Build"
|
||||||
command: "cargo build --release"
|
command: "cargo build"
|
||||||
- run:
|
- run:
|
||||||
name: "Test"
|
name: "Test"
|
||||||
command: "cargo test"
|
command: "cargo test"
|
||||||
- run:
|
- run:
|
||||||
name: "Launch in background"
|
name: "Test end-to-end"
|
||||||
command: "./target/release/pgcat & pgbench -i -h 127.0.0.1 -p 6432 & pgbench -h 127.0.0.1 -p 6432 --protocol extended -t 100 -c 2"
|
command: "bash .circleci/run_tests.sh"
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: cargo-lock-3-{{ checksum "Cargo.lock" }}
|
key: cargo-lock-2-{{ checksum "Cargo.lock" }}
|
||||||
paths:
|
paths:
|
||||||
- target
|
- target
|
||||||
- ~/.cargo
|
- ~/.cargo
|
||||||
|
|||||||
23
.circleci/run_tests.sh
Normal file
23
.circleci/run_tests.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
./target/debug/pgcat &
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
psql -f tests/sharding/query_routing_setup.sql
|
||||||
|
|
||||||
|
# Setup PgBench
|
||||||
|
pgbench -i -h 127.0.0.1 -p 6432
|
||||||
|
|
||||||
|
# Run it
|
||||||
|
pgbench -h 127.0.0.1 -p 6432 -t 500 -c 2
|
||||||
|
|
||||||
|
psql -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_insert.sql
|
||||||
|
|
||||||
|
psql -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_select.sql
|
||||||
|
|
||||||
|
# psql -f tests/sharding/query_routing_test_validate.sql
|
||||||
|
|
||||||
|
psql -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_primary_replica.sql
|
||||||
Reference in New Issue
Block a user