~mthaddon/mojo/graylog-load-checks

« back to all changes in this revision

Viewing changes to charm-testing/apache-openid/post-deploy

  • Committer: mergebot at canonical
  • Author(s): "Jamon Camisso"
  • Date: 2018-07-23 17:19:40 UTC
  • mfrom: (121.1.6 mojo-specs)
  • Revision ID: mergebot@juju-139df4-prod-is-toolbox-0.canonical.com-20180723171940-3ybrrowllg2m51sg
Add apache-openid spec for bionic & xenial testing

Reviewed-on: https://code.launchpad.net/~jamon/mojo/apache-openid-test/+merge/349769
Reviewed-by: Tom Haddon <tom.haddon@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
APACHE=$(juju status --format=yaml apache2 2>&1 | sed -nr '/^ {8}public-address/s/.*://p')
 
4
TEAMS=$(juju config apache-openid --format=json |jq -r '.settings .authorized_teams .value'| sed 's/ /\n/g')
 
5
 
 
6
if [ -z "${APACHE}" ]; then
 
7
    echo "No apache2 instances"
 
8
    exit 1
 
9
fi
 
10
 
 
11
for UNIT in ${APACHE}; do
 
12
 
 
13
    echo "Calling unit to ensure it returns SSO redirect"
 
14
    echo "curl -sik \"https://${UNIT}\" |egrep 'location:.+openid/\+login'"
 
15
    curl -sik "https://${UNIT}" |egrep 'location:.+openid/\+login' 
 
16
    if [ $? -ne 0 ]; then
 
17
        echo "####################"
 
18
        echo "# E2E Check Failed #"
 
19
        echo "####################"
 
20
        exit 1
 
21
    fi
 
22
 
 
23
    echo "Checking unit's /etc/apache2/openid/teams.txt matches authorized_teams setting"
 
24
    AUTHORIZED_TEAMS=$(juju run --application apache2 'sudo cat /etc/apache2/openid/teams.txt' --format=json |jq -r '.[] .Stdout'|sed '/^$/d')
 
25
    if [ "${TEAMS}" != "${AUTHORIZED_TEAMS}" ]; then
 
26
        echo "####################"
 
27
        echo "# E2E Check Failed #"
 
28
        echo "####################"
 
29
        exit 1
 
30
    fi
 
31
done
 
32
 
 
33
# If we are here it means no checks failed
 
34
echo "####################"
 
35
echo "# E2E Check Passed #"
 
36
echo "####################"