From 37a51f8c3841c8784b4889adbe834b72ea24e372 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 12 Feb 2015 15:28:20 -0200 Subject: [PATCH] test_helper: make IP addresses available as variables --- test/colab_test.sh | 3 +-- test/test_helper.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/colab_test.sh b/test/colab_test.sh index 14048e2..adc0e82 100644 --- a/test/colab_test.sh +++ b/test/colab_test.sh @@ -21,8 +21,7 @@ test_nginx_responds() { } test_nginx_virtualhost() { - local ip="$(grep integration: nodes.yaml | cut -d : -f 2)" - local title="$(./test/bin/curl http://$ip/dashboard | grep '' | sed -e 's/^\s*//')" + local title="$(./test/bin/curl http://$integration/dashboard | grep '<title>' | sed -e 's/^\s*//')" assertEquals "<title>Home - Colab" "$title" } diff --git a/test/test_helper.sh b/test/test_helper.sh index 165c963..b60fbe4 100644 --- a/test/test_helper.sh +++ b/test/test_helper.sh @@ -5,3 +5,13 @@ run_on() { } curl=/vagrant/test/bin/curl + +# make IP addresses avaliable at the environment so we can refer to hosts by +# name, e.g. +# +# curl http://$reverseproxy +# nmap -p 5423 $database +# +# Each node in the `peers:` entry in nodes.yaml will have its own variable +# +eval $(ruby -ryaml -e 'YAML.load_file("nodes.yaml").first[1]["peers"].each { |k,v| puts "#{k}=#{v}" }') -- libgit2 0.21.2