From 20dd07354dd278305019e2ed928a839cc9ca7bac Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Fri, 10 Apr 2015 20:53:21 +0700 Subject: [PATCH] add the integration test for file discovery Signed-off-by: Chanwit Kaewkasi --- test/integration/file-discovery.bats | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/integration/file-discovery.bats diff --git a/test/integration/file-discovery.bats b/test/integration/file-discovery.bats new file mode 100644 index 0000000000..0341f0e5cf --- /dev/null +++ b/test/integration/file-discovery.bats @@ -0,0 +1,28 @@ +#!/usr/bin/env bats + +load helpers + +# create a blank temp file for discovery +DISCOVERY_FILE=$(mktemp) + +function teardown() { + swarm_manage_cleanup + rm -f $DISCOVERY_FILE + stop_docker +} + +function setup_file_discovery() { + for host in ${HOSTS[@]}; do + echo "$host" >> $DISCOVERY_FILE + done +} + +@test "docker info should return the number of nodes with file discovery" { + start_docker 2 + setup_file_discovery + swarm_manage file://$DISCOVERY_FILE + + run docker_swarm info + [ "$status" -eq 0 ] + [[ "${lines[3]}" == *"Nodes: 2" ]] +}