From c74cf900ef3b064c264ffc6a4bbe0c4c90ff662d Mon Sep 17 00:00:00 2001 From: Alexandre Beslic Date: Fri, 2 Oct 2015 08:42:14 -0700 Subject: [PATCH] Replace --leaderTTL flag by --replication-ttl Fixes #1256 Signed-off-by: Alexandre Beslic --- cli/flags.go | 2 +- cli/manage.go | 4 ++-- test/integration/replication.bats | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/flags.go b/cli/flags.go index 283082b064..feef1ce41f 100644 --- a/cli/flags.go +++ b/cli/flags.go @@ -118,7 +118,7 @@ var ( Usage: "Enable Swarm manager replication", } flLeaderTTL = cli.StringFlag{ - Name: "leaderTTL", + Name: "replication-ttl", Value: "30s", Usage: "Leader lock release time on failure", } diff --git a/cli/manage.go b/cli/manage.go index 1159fcaa11..19493ae154 100644 --- a/cli/manage.go +++ b/cli/manage.go @@ -268,9 +268,9 @@ func manage(c *cli.Context) { if !checkAddrFormat(addr) { log.Fatal("--advertise should be of the form ip:port or hostname:port") } - leaderTTL, err := time.ParseDuration(c.String("leaderTTL")) + leaderTTL, err := time.ParseDuration(c.String("replication-ttl")) if err != nil { - log.Fatalf("invalid --leaderTTL: %v", err) + log.Fatalf("invalid --replication-ttl: %v", err) } setupReplication(c, cl, server, discovery, addr, leaderTTL, tlsConfig) diff --git a/test/integration/replication.bats b/test/integration/replication.bats index b72b15d114..e5e3040143 100644 --- a/test/integration/replication.bats +++ b/test/integration/replication.bats @@ -38,12 +38,12 @@ function teardown() { local host=127.0.0.1:$port # Bring up one manager, make sure it becomes primary. - swarm_manage --replication --leaderTTL "4s" --advertise 127.0.0.1:$SWARM_BASE_PORT "$DISCOVERY" + swarm_manage --replication --replication-ttl "4s" --advertise 127.0.0.1:$SWARM_BASE_PORT "$DISCOVERY" run docker -H ${SWARM_HOSTS[0]} info [[ "${output}" == *"Role: primary"* ]] # Fire up a second manager. Ensure it's a replica forwarding to the right primary. - swarm_manage --replication --leaderTTL "4s" --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 1)) "$DISCOVERY" + swarm_manage --replication --replication-ttl "4s" --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 1)) "$DISCOVERY" run docker -H ${SWARM_HOSTS[1]} info [[ "${output}" == *"Role: replica"* ]] [[ "${output}" == *"Primary: ${SWARM_HOSTS[0]}"* ]] @@ -53,7 +53,7 @@ function teardown() { retry 20 1 eval "docker -H ${SWARM_HOSTS[1]} info | grep -q 'Role: primary'" # Add a new replica and make sure it sees the new leader as primary. - swarm_manage --replication --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 2)) "$DISCOVERY" + swarm_manage --replication --replication-ttl "4s" --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 2)) "$DISCOVERY" run docker -H ${SWARM_HOSTS[2]} info [[ "${output}" == *"Role: replica"* ]] [[ "${output}" == *"Primary: ${SWARM_HOSTS[1]}"* ]] @@ -61,18 +61,18 @@ function teardown() { @test "leader election - store failure" { # Bring up one manager, make sure it becomes primary. - swarm_manage --replication --leaderTTL "4s" --advertise 127.0.0.1:$SWARM_BASE_PORT "$DISCOVERY" + swarm_manage --replication --replication-ttl "4s" --advertise 127.0.0.1:$SWARM_BASE_PORT "$DISCOVERY" run docker -H ${SWARM_HOSTS[0]} info [[ "${output}" == *"Role: primary"* ]] # Fire up a second manager. Ensure it's a replica forwarding to the right primary. - swarm_manage --replication --leaderTTL "4s" --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 1)) "$DISCOVERY" + swarm_manage --replication --replication-ttl "4s" --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 1)) "$DISCOVERY" run docker -H ${SWARM_HOSTS[1]} info [[ "${output}" == *"Role: replica"* ]] [[ "${output}" == *"Primary: ${SWARM_HOSTS[0]}"* ]] # Fire up a third manager. Ensure it's a replica forwarding to the right primary. - swarm_manage --replication --leaderTTL "4s" --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 2)) "$DISCOVERY" + swarm_manage --replication --replication-ttl "4s" --advertise 127.0.0.1:$(($SWARM_BASE_PORT + 2)) "$DISCOVERY" run docker -H ${SWARM_HOSTS[2]} info [[ "${output}" == *"Role: replica"* ]] [[ "${output}" == *"Primary: ${SWARM_HOSTS[0]}"* ]]