diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-18 13:38:58 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-18 13:38:58 +0200 |
commit | 83c13f1181c4062ca5296ea956e950064bde0ffe (patch) | |
tree | ea021190acabc6e675510e13987cd4addbf50765 /test | |
parent | 993c9a7807e38b365f48334fff6640e07647af03 (diff) | |
download | app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.gz app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.bz2 app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.xz app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.zip |
o Making all scripts be run from the root/ directory. Do not assume you're in current/.
Diffstat (limited to 'test')
-rwxr-xr-x | test/app-install.bats | 6 | ||||
-rw-r--r-- | test/data/app-a/root/bin/app-a | 11 | ||||
-rw-r--r-- | test/data/app-a/scripts/postinstall | 18 | ||||
-rwxr-xr-x | test/it-install-remove.bats | 11 |
4 files changed, 28 insertions, 18 deletions
diff --git a/test/app-install.bats b/test/app-install.bats index df77594..7c7d642 100755 --- a/test/app-install.bats +++ b/test/app-install.bats @@ -18,9 +18,10 @@ load utils Unpacking... Running postinstall... Hello World! +Creating logs directory Postinstall completed successfully Changing current symlink" ] - [ ${#lines[*]} == 6 ] + [ ${#lines[*]} == 7 ] } @test "./app instance install install-test-env" { @@ -40,10 +41,11 @@ APPSH_INSTANCE=prod APPSH_NAME=install-test-env APPSH_VERSION=1.0 PATH=/bin:/usr/bin -PWD=$APPSH_APPS_CANONICAL/install-test-env/prod/versions/1.0 +PWD=$APPSH_APPS_CANONICAL/install-test-env/prod/versions/1.0/root SHLVL=1 _=/usr/bin/env Postinstall completed successfully Changing current symlink" ] [ ${#lines[*]} == 14 ] +# PWD=$APPSH_APPS_CANONICAL/install-test-env/prod/versions/1.0 } diff --git a/test/data/app-a/root/bin/app-a b/test/data/app-a/root/bin/app-a index c8c4fc5..98d98cd 100644 --- a/test/data/app-a/root/bin/app-a +++ b/test/data/app-a/root/bin/app-a @@ -1,15 +1,16 @@ #!/bin/bash -me=$APPSH_INSTANCE_HOME/`basename $0` +#cd $APPSH_INSTANCE_HOME +me=`basename $0` -echo "Starting" >> $me.log +env | grep TEST_PROPERTY >> logs/$me.env -env | grep TEST_PROPERTY > $me.env +echo "Starting" >> logs/$me.log for i in {1..10} do - echo "#$i: `date`" >> $me.log + echo "#$i: `date`" >> logs/$me.log sleep 1 done -echo "Exiting" >> $me.log +echo "Exiting" >> logs/$me.log diff --git a/test/data/app-a/scripts/postinstall b/test/data/app-a/scripts/postinstall index a77f86f..c1a0cf1 100644 --- a/test/data/app-a/scripts/postinstall +++ b/test/data/app-a/scripts/postinstall @@ -1,11 +1,21 @@ -#!/bin/bash +#!/bin/bash -e echo "Hello World!" -if [ -d root/etc/$APPSH_INSTANCE ] +if [ -d etc/$APPSH_INSTANCE ] then - find root/etc/$APPSH_INSTANCE -type f -maxdepth 1 | while read file + find etc/$APPSH_INSTANCE -type f -maxdepth 1 | while read file do - cp $file root/ + cp $file . done fi + +LOGS=$APPSH_APPS/$APPSH_NAME/$APPSH_INSTANCE/logs + +if [ ! -d $LOGS ] +then + echo "Creating logs directory" + mkdir $LOGS +fi + +ln -s $LOGS logs diff --git a/test/it-install-remove.bats b/test/it-install-remove.bats index 5eb9f46..78f4532 100755 --- a/test/it-install-remove.bats +++ b/test/it-install-remove.bats @@ -34,15 +34,12 @@ load utils echo_lines can_not_read .app/var/pid/$name-$instance.pid - can_read "$name/$instance/$name.log" - can_read "$name/$instance/$name.env" + can_read "$name/$instance/logs/$name.log" + can_read "$name/$instance/logs/$name.env" can_read "$name/$instance/current/foo.conf" - [ "`cat $name/$instance/$name.env`" = "TEST_PROPERTY=awesome" ] + [ "`cat $name/$instance/logs/$name.env`" = "TEST_PROPERTY=awesome" ] [ "`cat $name/$instance/current/foo.conf`" = "hello" ] -# app instance install \ -# -r file \ -# -u $HOME/.m2/repository/io/trygvis/appsh/examples/jenkins/1.0-SNAPSHOT/jenkins-1.0-SNAPSHOT.zip \ -# -n jenkins -i env-a + # TODO: Remove the version } |