github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/public-cloud-check.bash (about) 1 #!/bin/bash 2 set -e 3 4 # A simple test that ensures that the streams stored public-clouds.yaml match 5 # what is built into the Juju under test. 6 # Basically setup a pristine JUJU_DATA, run juju upgrade-clouds, if a public-clouds.yaml exists fail. 7 8 function usage() { 9 echo "Usage: $0 <path to juju binary>" 10 } 11 12 function cleanup() { 13 if [ ! -z "${test_tmpdir+x}" ]; then 14 rm -fr ${test_tmpdir} 15 fi 16 } 17 18 trap cleanup EXIT 19 20 if [ "$#" -ne 1 ]; then 21 usage 22 exit 1 23 fi 24 25 juju_bin=$1 26 test_tmpdir=$(mktemp -d) 27 export JUJU_DATA="${test_tmpdir}" 28 29 ${juju_bin} --show-log update-clouds 30 31 # The public-clouds.yaml published must match what is built into the Juju binary 32 # under test. 33 public_clouds_file="${JUJU_DATA}/public-clouds.yaml" 34 if [ -f ${public_clouds_file} ]; then 35 echo -e "\nFAIL: File exists when it shouldn't: ${public_clouds_file}" 36 exit 1 37 fi 38 39 echo -e "\nPASS" 40 exit 0