You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/basic_replication.feature
+40-40Lines changed: 40 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -2,84 +2,84 @@ Feature: basic replication
2
2
We should check that the basic bootstrapping, replication and failover works.
3
3
4
4
Scenario: check replication of a single table
5
-
Given I start postgres0
6
-
Then postgres0 is a leader after 10 seconds
5
+
Given I start postgres-0
6
+
Then postgres-0 is a leader after 10 seconds
7
7
And there is a non empty initialize key in DCS after 15 seconds
8
8
When I issue a PATCH request to http://127.0.0.1:8008/config with {"ttl": 20, "synchronous_mode": true}
9
9
Then I receive a response code 200
10
-
When I start postgres1
11
-
And I configure and start postgres2 with a tag replicatefrom postgres0
12
-
And "sync" key in DCS has leader=postgres0 after 20 seconds
13
-
And I add the table foo to postgres0
14
-
Then table foo is present on postgres1 after 20 seconds
15
-
Then table foo is present on postgres2 after 20 seconds
10
+
When I start postgres-1
11
+
And I configure and start postgres-2 with a tag replicatefrom postgres-0
12
+
And "sync" key in DCS has leader=postgres-0 after 20 seconds
13
+
And I add the table foo to postgres-0
14
+
Then table foo is present on postgres-1 after 20 seconds
15
+
Then table foo is present on postgres-2 after 20 seconds
16
16
17
17
Scenario: check restart of sync replica
18
-
Given I shut down postgres2
19
-
Then "sync" key in DCS has sync_standby=postgres1 after 5 seconds
20
-
When I start postgres2
21
-
And I shut down postgres1
22
-
Then "sync" key in DCS has sync_standby=postgres2 after 10 seconds
23
-
When I start postgres1
24
-
Then "members/postgres1" key in DCS has state=running after 10 seconds
18
+
Given I shut down postgres-2
19
+
Then "sync" key in DCS has sync_standby=postgres-1 after 5 seconds
20
+
When I start postgres-2
21
+
And I shut down postgres-1
22
+
Then "sync" key in DCS has sync_standby=postgres-2 after 10 seconds
23
+
When I start postgres-1
24
+
Then "members/postgres-1" key in DCS has state=running after 10 seconds
25
25
And Status code on GET http://127.0.0.1:8010/sync is 200 after 3 seconds
26
26
And Status code on GET http://127.0.0.1:8009/async is 200 after 3 seconds
27
27
28
28
Scenario: check stuck sync replica
29
29
Given I issue a PATCH request to http://127.0.0.1:8008/config with {"pause": true, "maximum_lag_on_syncnode": 15000000, "postgresql": {"parameters": {"synchronous_commit": "remote_apply"}}}
30
30
Then I receive a response code 200
31
-
And I create table on postgres0
32
-
And table mytest is present on postgres1 after 2 seconds
33
-
And table mytest is present on postgres2 after 2 seconds
34
-
When I pause wal replay on postgres2
35
-
And I load data on postgres0
36
-
Then "sync" key in DCS has sync_standby=postgres1 after 15 seconds
37
-
And I resume wal replay on postgres2
31
+
And I create table on postgres-0
32
+
And table mytest is present on postgres-1 after 2 seconds
33
+
And table mytest is present on postgres-2 after 2 seconds
34
+
When I pause wal replay on postgres-2
35
+
And I load data on postgres-0
36
+
Then "sync" key in DCS has sync_standby=postgres-1 after 15 seconds
37
+
And I resume wal replay on postgres-2
38
38
And Status code on GET http://127.0.0.1:8009/sync is 200 after 3 seconds
39
39
And Status code on GET http://127.0.0.1:8010/async is 200 after 3 seconds
40
40
When I issue a PATCH request to http://127.0.0.1:8008/config with {"pause": null, "maximum_lag_on_syncnode": -1, "postgresql": {"parameters": {"synchronous_commit": "on"}}}
41
41
Then I receive a response code 200
42
-
And I drop table on postgres0
42
+
And I drop table on postgres-0
43
43
44
44
Scenario: check multi sync replication
45
45
Given I issue a PATCH request to http://127.0.0.1:8008/config with {"synchronous_node_count": 2}
46
46
Then I receive a response code 200
47
-
Then "sync" key in DCS has sync_standby=postgres1,postgres2 after 10 seconds
47
+
Then "sync" key in DCS has sync_standby=postgres-1,postgres-2 after 10 seconds
48
48
And Status code on GET http://127.0.0.1:8010/sync is 200 after 3 seconds
49
49
And Status code on GET http://127.0.0.1:8009/sync is 200 after 3 seconds
50
50
When I issue a PATCH request to http://127.0.0.1:8008/config with {"synchronous_node_count": 1}
51
51
Then I receive a response code 200
52
-
And I shut down postgres1
53
-
Then "sync" key in DCS has sync_standby=postgres2 after 10 seconds
54
-
When I start postgres1
55
-
Then "members/postgres1" key in DCS has state=running after 10 seconds
52
+
And I shut down postgres-1
53
+
Then "sync" key in DCS has sync_standby=postgres-2 after 10 seconds
54
+
When I start postgres-1
55
+
Then "members/postgres-1" key in DCS has state=running after 10 seconds
56
56
And Status code on GET http://127.0.0.1:8010/sync is 200 after 3 seconds
57
57
And Status code on GET http://127.0.0.1:8009/async is 200 after 3 seconds
58
58
59
59
Scenario: check the basic failover in synchronous mode
60
60
Given I run patronictl.py pause batman
61
61
Then I receive a response returncode 0
62
62
When I sleep for 2 seconds
63
-
And I shut down postgres0
63
+
And I shut down postgres-0
64
64
And I run patronictl.py resume batman
65
65
Then I receive a response returncode 0
66
-
And postgres2 role is the primary after 24 seconds
66
+
And postgres-2 role is the primary after 24 seconds
67
67
And Response on GET http://127.0.0.1:8010/history contains recovery after 10 seconds
68
-
And there is a postgres2_cb.log with "on_role_change primary batman" in postgres2 data directory
68
+
And there is a postgres-2_cb.log with "on_role_change primary batman" in postgres-2 data directory
69
69
When I issue a PATCH request to http://127.0.0.1:8010/config with {"synchronous_mode": null, "master_start_timeout": 0}
70
70
Then I receive a response code 200
71
-
When I add the table bar to postgres2
72
-
Then table bar is present on postgres1 after 20 seconds
71
+
When I add the table bar to postgres-2
72
+
Then table bar is present on postgres-1 after 20 seconds
73
73
And Response on GET http://127.0.0.1:8010/config contains master_start_timeout after 10 seconds
74
74
75
75
Scenario: check rejoin of the former primary with pg_rewind
76
-
Given I add the table splitbrain to postgres0
77
-
And I start postgres0
78
-
Then postgres0 role is the secondary after 20 seconds
79
-
When I add the table buz to postgres2
80
-
Then table buz is present on postgres0 after 20 seconds
76
+
Given I add the table splitbrain to postgres-0
77
+
And I start postgres-0
78
+
Then postgres-0 role is the secondary after 20 seconds
79
+
When I add the table buz to postgres-2
80
+
Then table buz is present on postgres-0 after 20 seconds
81
81
82
82
@reject-duplicate-name
83
83
Scenario: check graceful rejection when two nodes have the same name
84
-
Given I start duplicate postgres0 on port 8011
85
-
Then there is one of ["Can't start; there is already a node named 'postgres0' running"] CRITICAL in the dup-postgres0 patroni log after 5 seconds
84
+
Given I start duplicate postgres-0 on port 8011
85
+
Then there is one of ["Can't start; there is already a node named 'postgres-0' running"] CRITICAL in the dup-postgres-0 patroni log after 5 seconds
0 commit comments