diff --git a/integration/106_launch_with_peers_test.sh b/integration/106_launch_with_peers_test.sh new file mode 100755 index 000000000..d4a5e94da --- /dev/null +++ b/integration/106_launch_with_peers_test.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +. ./config.sh + +start_suite "Launch scope and check it boots, with a spurious host arg" + +scope_on $HOST1 launch noatrealhost.foo + +wait_for_containers $HOST1 60 weavescope + +has_container $HOST1 weavescope + +scope_end_suite diff --git a/integration/205_clustering_sans_weave_2_test.sh b/integration/205_clustering_sans_weave_2_test.sh index abd498682..21d5921a6 100755 --- a/integration/205_clustering_sans_weave_2_test.sh +++ b/integration/205_clustering_sans_weave_2_test.sh @@ -4,8 +4,8 @@ start_suite "Launch 2 scopes and check they cluster (without weave)" -scope_on $HOST1 launch $HOST1 $HOST2 -scope_on $HOST2 launch $HOST1 $HOST2 +scope_on $HOST1 launch $HOST2 +scope_on $HOST2 launch $HOST1 docker_on $HOST1 run -dit --name db1 peterbourgon/tns-db docker_on $HOST2 run -dit --name db2 peterbourgon/tns-db diff --git a/integration/215_clustering_split_2_test.sh b/integration/215_clustering_split_2_test.sh new file mode 100755 index 000000000..7a399976d --- /dev/null +++ b/integration/215_clustering_split_2_test.sh @@ -0,0 +1,17 @@ +#! /bin/bash + +. ./config.sh + +start_suite "Launch 2 scopes and check they cluster (without weave)" + +scope_on $HOST1 launch --no-app $HOST2 +scope_on $HOST2 launch --no-probe + +docker_on $HOST1 run -dit --name db1 peterbourgon/tns-db + +sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and send them reports. + +has_container $HOST2 weavescope +has_container $HOST2 db1 + +scope_end_suite diff --git a/prog/main.go b/prog/main.go index 0f701109b..72d999f3e 100644 --- a/prog/main.go +++ b/prog/main.go @@ -68,6 +68,7 @@ type probeFlags struct { logPrefix string logLevel string resolver string + noApp bool dockerEnabled bool dockerInterval time.Duration @@ -115,12 +116,13 @@ func main() { flag.BoolVar(&debug, "debug", false, "Force debug logging.") flag.StringVar(&weaveHostname, "weave.hostname", "", "Hostname to advertise/lookup in WeaveDNS") - // We can ignore these - we need to know how to parse them, but they are interpreted by the entrypoint script. - // They are also here so they are included in usage. - flag.Bool("no-app", false, "Don't run the app.") + // We need to know how to parse them, but they are mainly interpreted by the entrypoint script. + // They are also here so they are included in usage, and the probe uses them to decide if to + // publish to localhost. + noApp := flag.Bool("no-app", false, "Don't run the app.") + probeOnly := flag.Bool("app-only", false, "Only run the app") flag.Bool("probe-only", false, "Only run the probe.") flag.Bool("no-probe", false, "Don't run the probe.") - flag.Bool("app-only", false, "Only run the app") // Probe flags flag.StringVar(&flags.probe.token, "service-token", "", "Token to use to authenticate with scope.weave.works") @@ -176,6 +178,7 @@ func main() { flags.probe.weaveHostname = weaveHostname flags.app.weaveHostname = weaveHostname } + flags.probe.noApp = *noApp || *probeOnly switch mode { case "app": diff --git a/prog/probe.go b/prog/probe.go index b0c2673bc..89d806232 100644 --- a/prog/probe.go +++ b/prog/probe.go @@ -94,9 +94,12 @@ func probeMain(flags probeFlags) { } go check(checkpointFlags) - var targets = []string{fmt.Sprintf("localhost:%d", xfer.AppPort)} + var targets = []string{} + if !flags.noApp { + targets = append(targets, fmt.Sprintf("localhost:%d", xfer.AppPort)) + } if len(flag.Args()) > 0 { - targets = flag.Args() + targets = append(targets, flag.Args()...) } log.Infof("publishing to: %s", strings.Join(targets, ", "))