提交 cb5d0ba4 编写于 作者: K Kalen Krempely 提交者: Kalen Krempely

gpaddmirrors behave tests: don't use pkill

Remove behave step "the database is killed on hosts mdw,sdw1,sdw2" in
favor of "the database is not running. This shuts down the databse more
cleanly, and avoids any potential race conditons.

(cherry picked from commit 8079bd2be75f0624212d7c4907ea16e8c5a5d199)
上级 db47b998
......@@ -20,7 +20,7 @@ Feature: Tests for gpaddmirrors
@concourse_cluster
Scenario: gprecoverseg works correctly on a newly added mirror
Given a working directory of the test as '/tmp/gpaddmirrors'
And the database is killed on hosts "mdw,sdw1,sdw2"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1, sdw2"
And gpaddmirrors adds mirrors
Then verify the database has mirrors
......@@ -35,12 +35,12 @@ Feature: Tests for gpaddmirrors
@concourse_cluster
Scenario: gpaddmirrors puts mirrors on the same hosts when there is a standby configured
Given a working directory of the test as '/tmp/gpaddmirrors'
And the database is killed on hosts "mdw,sdw1,sdw2,sdw3"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1, sdw2, sdw3"
And gpaddmirrors adds mirrors
Then verify the database has mirrors
And save the gparray to context
And the database is killed on hosts "mdw,sdw1,sdw2,sdw3"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1, sdw2, sdw3"
And the user runs gpinitstandby with options " "
Then gpinitstandby should return a return code of 0
......@@ -51,7 +51,7 @@ Feature: Tests for gpaddmirrors
@concourse_cluster
Scenario: gpaddmirrors puts mirrors on different host
Given a working directory of the test as '/tmp/gpaddmirrors'
And the database is killed on hosts "mdw,sdw1,sdw2,sdw3"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1, sdw2, sdw3"
And gpaddmirrors adds mirrors in spread configuration
Then verify that mirror segments are in "spread" configuration
......@@ -60,7 +60,7 @@ Feature: Tests for gpaddmirrors
@concourse_cluster
Scenario: gpaddmirrors with a default master data directory
Given a working directory of the test as '/tmp/gpaddmirrors'
And the database is killed on hosts "mdw,sdw1"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1"
And gpaddmirrors adds mirrors
Then verify the database has mirrors
......@@ -69,7 +69,7 @@ Feature: Tests for gpaddmirrors
@concourse_cluster
Scenario: gpaddmirrors with a given master data directory [-d <master datadir>]
Given a working directory of the test as '/tmp/gpaddmirrors'
And the database is killed on hosts "mdw,sdw1"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1"
And gpaddmirrors adds mirrors with temporary data dir
Then verify the database has mirrors
......@@ -78,7 +78,7 @@ Feature: Tests for gpaddmirrors
@concourse_cluster
Scenario: gpaddmirrors mirrors are recognized after a cluster restart
Given a working directory of the test as '/tmp/gpaddmirrors'
And the database is killed on hosts "mdw,sdw1"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1"
When gpaddmirrors adds mirrors
Then verify the database has mirrors
......@@ -94,7 +94,7 @@ Feature: Tests for gpaddmirrors
@concourse_cluster
Scenario: gpaddmirrors when the primaries have data
Given a working directory of the test as '/tmp/gpaddmirrors'
And the database is killed on hosts "mdw,sdw1"
And the database is not running
And a cluster is created with no mirrors on "mdw" and "sdw1"
And database "gptest" exists
And there is a "heap" table "public.heap_table" in "gptest" with "100" rows
......
......@@ -228,8 +228,10 @@ def impl(context, checksum_toggle):
if ('PGDATABASE' in os.environ):
run_command(context, "createdb %s" % os.getenv('PGDATABASE'))
@given('the database is not running')
@when('the database is not running')
@then('the database is not running')
def impl(context):
stop_database_if_started(context)
if has_exception(context):
......@@ -2366,16 +2368,6 @@ def impl(context, hostnames):
if hasattr(context, "temp_base_dir"):
reset_hosts(hosts, context.temp_base_dir)
@then('the database is killed on hosts "{hostnames}"')
@given('the database is killed on hosts "{hostnames}"')
def impl(context, hostnames):
hosts = hostnames.split(",")
for host in hosts:
cmd = Command(name='pkill postgres',
cmdStr="pkill postgres || true",
ctxt=REMOTE,
remoteHost=host)
cmd.run(validateAfter=True)
@given('user has created expansiontest tables')
@then('user has created expansiontest tables')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册