|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -eu -o pipefail |
| 3 | + |
| 4 | +RELEASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)/config-server" |
| 5 | + |
| 6 | +if [[ -n "${DEBUG:-}" ]]; then |
| 7 | + set -x |
| 8 | + export BOSH_LOG_LEVEL=debug |
| 9 | +fi |
| 10 | + |
| 11 | +echo "Starting BOSH Director" |
| 12 | +source start-bosh |
| 13 | +source /tmp/local-bosh/director/bosh-env |
| 14 | + |
| 15 | +echo "Uploading stemcell" |
| 16 | +bosh -n upload-stemcell stemcell/*.tgz |
| 17 | + |
| 18 | +echo "Uploading BPM release" |
| 19 | +bosh -n upload-release /usr/local/releases/bpm.tgz |
| 20 | + |
| 21 | +echo "Creating and uploading config-server release" |
| 22 | +bosh create-release --dir "${RELEASE_PATH}" |
| 23 | +bosh upload-release --dir "${RELEASE_PATH}" |
| 24 | + |
| 25 | +echo "Deploying config-server" |
| 26 | +bosh -n -d config-server-test deploy \ |
| 27 | + --var=stemcell_os="${STEMCELL_OS}" \ |
| 28 | + --vars-store=/tmp/config-server-test-creds.yml \ |
| 29 | + "${RELEASE_PATH}/manifests/test.yml" |
| 30 | + |
| 31 | +echo "Deployment complete. Instances:" |
| 32 | +bosh -d config-server-test instances --details |
| 33 | + |
| 34 | +CS_IP="$(bosh -d config-server-test instances | grep running | awk '{ print $4 }')" |
| 35 | +echo "config-server IP: ${CS_IP}" |
| 36 | + |
| 37 | +echo "Verifying config-server API responds..." |
| 38 | +response_code="$(curl -sk -o /dev/null -w "%{http_code}" "https://${CS_IP}:8080/v1/data?name=test-key")" |
| 39 | + |
| 40 | +if [[ "${response_code}" == "401" ]]; then |
| 41 | + echo "SUCCESS: config-server is responding correctly (received expected 401 Unauthorized)" |
| 42 | +else |
| 43 | + echo "ERROR: Expected HTTP 401 from config-server, got HTTP ${response_code}" |
| 44 | + exit 1 |
| 45 | +fi |
0 commit comments