From 1dcdd6eaa0c659043c4e7dfe09a7f2a7f2d11476 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Tue, 30 Aug 2016 16:50:07 +0200 Subject: [PATCH] Acceptance tests for pause mode --- features/patroni_api.feature | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/features/patroni_api.feature b/features/patroni_api.feature index 3febb376..e201613c 100644 --- a/features/patroni_api.feature +++ b/features/patroni_api.feature @@ -45,9 +45,11 @@ Scenario: check dynamic configuration change via DCS Then I receive a response code 200 And I receive a response tags {'tag': 'new_value'} -Scenario: check API requests for the primary-replica pair - Given I start postgres1 - And replication works from postgres0 to postgres1 after 20 seconds +Scenario: check API requests for the primary-replica pair in the pause mode + Given I run patronictl.py pause batman + Then I receive a response returncode 0 + When I start postgres1 + Then replication works from postgres0 to postgres1 after 20 seconds When I issue a GET request to http://127.0.0.1:8009/replica Then I receive a response code 200 And I receive a response state running @@ -62,7 +64,7 @@ Scenario: check API requests for the primary-replica pair When I sleep for 10 seconds Then postgres1 role is the secondary after 15 seconds -Scenario: check the failover via the API +Scenario: check the failover via the API in the pause mode Given I run patronictl.py failover batman --master postgres0 --candidate postgres1 --force Then I receive a response returncode 0 And postgres1 is a leader after 5 seconds @@ -71,6 +73,11 @@ Scenario: check the failover via the API And replication works from postgres1 to postgres0 after 20 seconds Scenario: check the scheduled failover + Given I issue a scheduled failover from postgres1 to postgres0 in 1 seconds + Then I receive a response returncode 1 + And I receive a response output "Can't schedule failover in the paused state" + When I run patronictl.py resume batman + Then I receive a response returncode 0 Given I issue a scheduled failover from postgres1 to postgres0 in 1 seconds Then I receive a response returncode 0 And postgres0 is a leader after 20 seconds @@ -84,7 +91,7 @@ Scenario: check the scheduled restart And Response on GET http://127.0.0.1:8008/patroni contains pending_restart after 5 seconds Given I issue a scheduled restart at http://127.0.0.1:8008 in 1 seconds with {"role": "replica"} Then I receive a response code 202 - And I sleep for 10 seconds + And I sleep for 2 seconds And Response on GET http://127.0.0.1:8008/patroni contains pending_restart after 10 seconds Given I issue a scheduled restart at http://127.0.0.1:8008 in 1 seconds with {"restart_pending": "True"} Then I receive a response code 202