Browse Source

Merge pull request #2609 from infosiftr/ghost-basics

Add very simple new "ghost-basics" test to verify that Ghost starts up properly
yosifkit 8 năm trước cách đây
mục cha
commit
09ec8b0eb2
2 tập tin đã thay đổi với 33 bổ sung0 xóa
  1. 3 0
      test/config.sh
  2. 30 0
      test/tests/ghost-basics/run.sh

+ 3 - 0
test/config.sh

@@ -74,6 +74,9 @@ imageTests+=(
 		gcc-cpp-hello-world
 		golang-hello-world
 	'
+	[ghost]='
+		ghost-basics
+	'
 	[golang]='
 		golang-hello-world
 	'

+ 30 - 0
test/tests/ghost-basics/run.sh

@@ -0,0 +1,30 @@
+#!/bin/bash
+set -eo pipefail
+
+dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+serverImage="$1"
+
+# Use a client image with curl for testing
+clientImage='buildpack-deps:jessie-curl'
+
+# Create an instance of the container-under-test
+cid="$(docker run -d "$serverImage")"
+trap "docker rm -vf $cid > /dev/null" EXIT
+
+_request() {
+	local method="$1"
+	shift
+
+	local url="${1#/}"
+	shift
+
+	docker run --rm --link "$cid":ghost "$clientImage" \
+		curl -fs -X"$method" "$@" "http://ghost:2368/$url"
+}
+
+# Make sure that Ghost is listening and ready
+. "$dir/../../retry.sh" '_request GET / --output /dev/null'
+
+# Check that /ghost/ redirects to setup (the image is unconfigured by default)
+_request GET '/ghost/' -I | grep -q '^Location: .*setup'