#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=`basename $0` SANDPIT=`pwd` . $(ade-config ade_share_prefix)/include/adetestsupport.sh ############################################################################## # # Purpose of test: to verify basic paa functions # # Bug id: # ############################################################################## # Ensure dates are consistently formatted export LC_ALL=C # End of support functions # Set variables used in this test # Ensure DB is created in sandpit export PAA_RCDIR=$SANDPIT/.paa # Ensure effects on OS (modiying the *OS*'s idea of repos, restarting apache, etc) are not real export PAA_ROOTDIR=$SANDPIT # Force use of non-interactive editor mkdir $SANDPIT/bin echo -e '#!/bin/sh\n\ncat > $1' > $SANDPIT/bin/caton chmod 755 $SANDPIT/bin/caton export EDITOR=$SANDPIT/bin/caton mkdir -p $SANDPIT/etc/init.d echo -e '#!/bin/sh\n\necho -n "Reloading web server config: apache2."\nsleep 2\necho' > $SANDPIT/etc/init.d/apache2 chmod 755 $SANDPIT/etc/init.d/apache2 # Use a test-specific gpg configuration export GNUPGHOME=$SANDPIT/.gpupg # Don't use any running gpg-agent unset GPG_AGENT_INFO # Don't put the apache config files in $MODROOT/var 'cos they'll contaminate it. export PAA_STATE_PREFIX=$SANDPIT/var # Misc UNAMEN=$(uname -n) echo "setting up ..." # Create repo paa repo myrepo deb mirrored true # Configure repo paa editrepo myrepo <./" mirror_dir "$SANDPIT/mirrors/" freeze_dir "$SANDPIT/freezes/." indirect_dir "$SANDPIT/indirects/." mirror_cmd "touch \\\$(ls | wc -l)" EOF # Mirror repo paa mirror myrepo # Freeze repo paa freeze myrepo # Indirect repo paa host myhost deb debian squeeze amd64 paa indirect myrepo myhost NEWEST-FREEZE # Share repo paa host $(uname -n) deb debian lenny i386 paa share myrepo myhost echo echo "doing delete cascade ..." CMDS=( "paa unrepo myrepo" "paa unmirror myrepo" "paa unfreeze myrepo NEWEST-FREEZE" "paa unindirect myrepo myhost" "paa unshare myrepo myhost" ) for ((I=${#CMDS[*]}; I>0; I--)); do for ((J=0; J<$I; J++)); do if ((J != I-1)); then echo "running \"${CMDS[$J]}\" (which should fail) ..." adetestsupport_invert_rc "${CMDS[$J]}" else echo "running \"${CMDS[$J]}\" (which should work) ..." eval "${CMDS[$J]}" fi done done echo