Skip to content

Commit 12011be

Browse files
committed
tests
1 parent 86386c7 commit 12011be

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

.circleci/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@ jobs:
1515
username: mydockerhub-user
1616
password: $DOCKERHUB_PASSWORD
1717
environment:
18-
POSTGRES_USER: sharding_user
19-
POSTGRES_DB: shard0
18+
POSTGRES_USER: postgres
19+
POSTGRES_DB: postgres
2020
# Add steps to the job
2121
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
2222
steps:
2323
- checkout
2424
- restore_cache:
25-
key: cargo-lock-3-{{ checksum "Cargo.lock" }}
25+
key: cargo-lock-2-{{ checksum "Cargo.lock" }}
2626
- run:
2727
name: "Install dependencies"
2828
command: "sudo apt-get update && sudo apt-get install -y postgresql-contrib-12 postgresql-client-12"
2929
- run:
3030
name: "Build"
31-
command: "cargo build --release"
31+
command: "cargo build"
3232
- run:
3333
name: "Test"
3434
command: "cargo test"
3535
- run:
36-
name: "Launch in background"
37-
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"
36+
name: "Test end-to-end"
37+
command: "bash .circleci/run_tests.sh"
3838
- save_cache:
39-
key: cargo-lock-3-{{ checksum "Cargo.lock" }}
39+
key: cargo-lock-2-{{ checksum "Cargo.lock" }}
4040
paths:
4141
- target
4242
- ~/.cargo

.circleci/run_tests.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
./target/debug/pgcat &
6+
7+
sleep 1
8+
9+
psql -f tests/sharding/query_routing_setup.sql
10+
11+
# Setup PgBench
12+
pgbench -i -h 127.0.0.1 -p 6432
13+
14+
# Run it
15+
pgbench -h 127.0.0.1 -p 6432 -t 500 -c 2
16+
17+
psql -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_insert.sql
18+
19+
psql -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_select.sql
20+
21+
# psql -f tests/sharding/query_routing_test_validate.sql
22+
23+
psql -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_test_primary_replica.sql

0 commit comments

Comments
 (0)