Skip to content

Commit 3190eba

Browse files
committed
automate tests
1 parent e9491d8 commit 3190eba

File tree

5 files changed

+96
-3
lines changed

5 files changed

+96
-3
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/*.o
2+
**/*.so
3+
tests/perf/pref
4+
tests/perf/pref.linux
5+
6+

tests/deploy/cluster.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
3+
- hosts: nodes
4+
5+
roles:
6+
7+
- role: postgres
8+
pg_port: 15432
9+
pg_repo: https://github.com/kelvich/postgresql.git
10+
pg_version_tag: xtm_patched
11+
pg_destroy_and_init: true
12+
pg_datadir: ./postgrespro-data
13+
14+
tasks:
15+
16+
- name: clone dtm sources
17+
git: repo=https://github.com/kelvich/pg_tsdtm.git
18+
dest=./pg_tsdtm
19+
accept_hostkey=yes
20+
update=yes
21+
force=yes
22+
register: dtm_sources
23+
24+
- name: build dtm
25+
shell: "PG_CONFIG={{pg_dst}}/bin/pg_config make clean && PG_CONFIG={{pg_dst}}/bin/pg_config make -j {{makejobs}} install"
26+
args:
27+
chdir: ./pg_tsdtm
28+
when: dtm_sources.changed
29+
30+
- name: enable dtm extension on datanodes
31+
lineinfile:
32+
dest: "{{pg_datadir}}/postgresql.conf"
33+
regexp: "^shared_preload_libraries "
34+
line: "shared_preload_libraries = 'pg_dtm'"
35+
state: present
36+
37+
- name: restart postgrespro
38+
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ./postgrespro-data -l ./postgrespro-data/pg.log"

tests/deploy/hosts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
[clients]
2-
localhost
2+
158.250.29.4 ansible_ssh_user=cluster offset=6001
3+
158.250.29.7 ansible_ssh_user=cluster ansible_ssh_port=2299 offset=3001
34

45
[nodes]
5-
localhost
6+
158.250.29.5 ansible_ssh_user=cluster offset=5001
7+
158.250.29.6 ansible_ssh_user=cluster offset=4001
8+
158.250.29.8 ansible_ssh_user=cluster offset=2001
9+
158.250.29.9 ansible_ssh_user=cluster offset=1001
10+
158.250.29.10 ansible_ssh_user=cluster offset=1
611

712
[master]
8-
localhost
13+
158.250.29.10 ansible_ssh_user=cluster offset=1

tests/deploy/hosts.sample

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[clients]
2+
client1 ansible_ssh_user=cluster offset=6001
3+
4+
[nodes]
5+
nodes1 ansible_ssh_user=cluster offset=2001
6+
7+
[master]
8+
master1 ansible_ssh_user=cluster offset=1

tests/perf.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
3+
- hosts: clients
4+
gather_facts: no
5+
tasks:
6+
7+
- name: generate connstrings
8+
set_fact:
9+
connstr: "-C 'host={{item}} user=cluster port=15432 dbname=postgres' "
10+
with_items:
11+
groups['nodes'] | reverse | batch(nnodes | d(2) | int) | first
12+
register: connstrs
13+
14+
- name: make a list
15+
set_fact:
16+
connections: "{{ connstrs.results | map(attribute='ansible_facts.connstr') | join }}"
17+
18+
- name: copy transfers binary
19+
copy: src=perf/perf.linux dest=~/perf mode=a+x
20+
21+
- hosts: clients[0]
22+
gather_facts: no
23+
tasks:
24+
- name: fill the databases
25+
shell: "./perf {{connections}} -g -i"
26+
register: transfers_result
27+
- debug: "var=transfers_result"
28+
29+
- hosts: clients[0]
30+
gather_facts: no
31+
tasks:
32+
- name: run transfers
33+
shell: "./perf {{connections}} {{runkeys | d('-g -w 64 -r 1 -n 1000 -a 10000')}}"
34+
register: transfers_result
35+
- debug: var=transfers_result
36+

0 commit comments

Comments
 (0)