forked from patroni/patroni
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
114 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Feature: bootstrap annotations | ||
Check that user-configurable bootstrap annotations are set and removed with state change | ||
|
||
Scenario: check annotation for cluster bootstrap protection | ||
When I start postgres-0 | ||
Then postgres-0 is a leader after 10 seconds | ||
When I start postgres-1 in a cluster batman1 as a long-running clone of postgres-0 | ||
Then "members/postgres-1" key in DCS has state=running custom bootstrap script after 20 seconds | ||
And postgres-1 is annotated with "foo" | ||
And postgres-1 is a leader of batman1 after 20 seconds | ||
|
||
Scenario: check annotation for replica bootstrap protection | ||
When I do a backup of postgres-1 | ||
And I start postgres-2 in cluster batman1 using long-running backup_restore | ||
Then "members/postgres-2" key in DCS has state=creating replica after 20 seconds | ||
And postgres-2 is annotated with "foo" | ||
|
||
Scenario: check annotation is removed | ||
Given "members/postgres-1" key in DCS has state=running after 2 seconds | ||
And "members/postgres-2" key in DCS has state=running after 20 seconds | ||
Then postgres-1 is not annotated with "foo" | ||
And postgres-2 is not annotated with "foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import time | ||
|
||
from behave import step, then | ||
|
||
@step('I start {name:name} in a cluster {cluster_name:w} as a long-running clone of {name2:name}') | ||
def start_cluster_clone(context, name, cluster_name, name2): | ||
context.pctl.clone(name2, cluster_name, name, True) | ||
|
||
@step('I start {name:name} in cluster {cluster_name:w} using long-running backup_restore') | ||
def start_patroni(context, name, cluster_name): | ||
return context.pctl.start(name, custom_config={ | ||
"scope": cluster_name, | ||
"postgresql": { | ||
'create_replica_methods': ['backup_restore'], | ||
"backup_restore": context.pctl.backup_restore_config(long_running=True), | ||
'authentication': { | ||
'superuser': {'password': 'patroni1'}, | ||
'replication': {'password': 'rep-pass1'} | ||
} | ||
} | ||
}, max_wait_limit=-1) | ||
|
||
@then('{name:name} is annotated with "{annotation:w}"') | ||
def pod_annotated(context, name, annotation): | ||
print(context.dcs_ctl.pod_annotations(name)) | ||
assert annotation in context.dcs_ctl.pod_annotations(name), f'pod {name} is not annotated with {annotation}' | ||
|
||
@then('{name:name} is not annotated with "{annotation:w}"') | ||
def pod_annotated(context, name, annotation): | ||
print(context.dcs_ctl.pod_annotations(name)) | ||
assert annotation not in context.dcs_ctl.pod_annotations(name), f'pod {name} is still annotated with {annotation}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters