diff --git a/test/bin/curl b/test/bin/curl
index d81769d..8967727 100755
--- a/test/bin/curl
+++ b/test/bin/curl
@@ -5,10 +5,15 @@ set -e
unset http_proxy
unset https_proxy
+. $(dirname $0)/../ip_helper.sh
+
/usr/bin/curl \
--silent \
--noproxy '*' \
--fail \
--insecure \
- --header 'Host: softwarepublico.dev' \
+ --resolve softwarepublico.dev:80:$reverseproxy \
+ --resolve softwarepublico.dev:443:$reverseproxy \
+ --resolve listas.softwarepublico.dev:80:$reverseproxy \
+ --resolve listas.softwarepublico.dev:443:$reverseproxy \
"$@"
diff --git a/test/colab_test.sh b/test/colab_test.sh
index adc0e82..57bbbe2 100644
--- a/test/colab_test.sh
+++ b/test/colab_test.sh
@@ -13,15 +13,15 @@ test_colab_running() {
}
test_colab_responds() {
- assertTrue 'colab responds' "run_on integration $curl http://localhost:8001"
+ assertTrue 'colab responds' "run_on integration curl --header 'Host: softwarepublico.dev' http://localhost:8001"
}
test_nginx_responds() {
- assertTrue 'nginx reponds' "run_on integration $curl http://localhost"
+ assertTrue 'nginx reponds' "run_on integration curl --header 'Host: softwarepublico.dev' http://localhost"
}
test_nginx_virtualhost() {
- local title="$(./test/bin/curl http://$integration/dashboard | grep '
' | sed -e 's/^\s*//')"
+ local title="$(curl --header 'Host: softwarepublico.dev' http://$integration/dashboard | grep '' | sed -e 's/^\s*//')"
assertEquals "Home - Colab" "$title"
}
diff --git a/test/ip_helper.sh b/test/ip_helper.sh
new file mode 100644
index 0000000..3687df5
--- /dev/null
+++ b/test/ip_helper.sh
@@ -0,0 +1,10 @@
+# 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}" }')
+
diff --git a/test/reverse_proxy_test.sh b/test/reverse_proxy_test.sh
index 707e7df..bae2ba4 100644
--- a/test/reverse_proxy_test.sh
+++ b/test/reverse_proxy_test.sh
@@ -1,12 +1,12 @@
. $(dirname $0)/test_helper.sh
test_redirect_http_to_https() {
- local redirect="$(./test/bin/curl --head http://$reverseproxy/ | sed -e '/Location:/ !d; s/\r//')"
+ local redirect="$(curl --header 'Host: softwarepublico.dev' --head http://$reverseproxy/ | sed -e '/Location:/ !d; s/\r//')"
assertEquals "Location: https://softwarepublico.dev/" "$redirect"
}
test_reverse_proxy_to_colab() {
- local title="$(./test/bin/curl https://$reverseproxy/dashboard | grep '' | sed -e 's/^\s*//')"
+ local title="$(curl --header 'Host: softwarepublico.dev' https://$reverseproxy/dashboard | grep '' | sed -e 's/^\s*//')"
assertEquals "Home - Colab" "$title"
}
diff --git a/test/test_helper.sh b/test/test_helper.sh
index 7d26132..3908222 100644
--- a/test/test_helper.sh
+++ b/test/test_helper.sh
@@ -1,3 +1,5 @@
+export PATH="$(dirname $0)/bin:$PATH"
+
run_on() {
local vm="$1"
shift
@@ -19,15 +21,4 @@ wait_for() {
return 1
}
-
-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}" }')
+. $(dirname $0)/ip_helper.sh
--
libgit2 0.21.2