From 4e882674e015df18b50800ee7354def2672c5d3f Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Thu, 26 Apr 2018 16:41:08 +0200 Subject: [PATCH] cmd/swarm: include localhost flag --- cmd/swarm/swarm-smoke/main.go | 18 ++++++++++++------ cmd/swarm/swarm-smoke/upload_and_sync.go | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cmd/swarm/swarm-smoke/main.go b/cmd/swarm/swarm-smoke/main.go index bab230afbc..87bc39816d 100644 --- a/cmd/swarm/swarm-smoke/main.go +++ b/cmd/swarm/swarm-smoke/main.go @@ -27,12 +27,13 @@ import ( ) var ( - endpoints []string - cluster string - scheme string - filesize int - from int - to int + endpoints []string + includeLocalhost bool + cluster string + scheme string + filesize int + from int + to int ) func main() { @@ -68,6 +69,11 @@ func main() { Usage: "http or https", Destination: &scheme, }, + cli.BoolFlag{ + Name: "include-localhost", + Usage: "whether to include localhost:8500 as an endpoint", + Destination: &includeLocalhost, + }, cli.IntFlag{ Name: "filesize", Value: 1, diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index d5ddb69c16..70c33d1465 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -24,6 +24,10 @@ func generateEndpoints(scheme string, cluster string, from int, to int) { for port := from; port <= to; port++ { endpoints = append(endpoints, fmt.Sprintf("%s://%v.%s.swarm-gateways.net", scheme, port, cluster)) } + + if includeLocalhost { + endpoints = append(endpoints, "http://localhost:8500") + } } func cliUploadAndSync(c *cli.Context) error {