~hloeung/mojo/charm-testing-influxdb

« back to all changes in this revision

Viewing changes to charm-testing/apache2/post-deploy

  • Committer: Jamon Camisso
  • Date: 2017-09-01 18:31:29 UTC
  • mfrom: (55.1.2 charm-testing-apache2)
  • Revision ID: jamon.camisso@canonical.com-20170901183129-1xib6nfn2byyi3ln
[mthaddon,r=jamon] Add a charm testing spec for Apache2 matching what we have for other promulgated charms

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# Put some content there to check
 
4
juju ssh apache2/0 "sudo mkdir -p /var/www/html && echo 'Sample content' > index.html && sudo mv index.html /var/www/html"
 
5
 
 
6
APACHE=$(juju status --format=yaml apache2 2>&1 | sed -nr '/^ {8}public-address/s/.*://p')
 
7
 
 
8
if [ -z "${APACHE}" ]; then
 
9
    echo "No apache2 instances"
 
10
    exit 1
 
11
fi
 
12
 
 
13
for UNIT in ${APACHE}; do
 
14
 
 
15
    echo "Calling unit to ensure it returns: Sample content"
 
16
    echo 'curl -f -k -s -S -v https://'${UNIT}'/|grep Sample content'
 
17
    curl -f -k -s -S -v https://${UNIT}/|grep "Sample content"
 
18
    if [ $? -ne 0 ]; then
 
19
        echo "####################"
 
20
        echo "# E2E Check Failed #"
 
21
        echo "####################"
 
22
        exit 1
 
23
    fi
 
24
done
 
25
 
 
26
# If we are here it means no checks failed
 
27
echo "####################"
 
28
echo "# E2E Check Passed #"
 
29
echo "####################"