diff --git a/test/tests/integration/bad-extensions.bats b/test/tests/integration/bad-extensions.bats index 51aae3c..311207b 100644 --- a/test/tests/integration/bad-extensions.bats +++ b/test/tests/integration/bad-extensions.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh diff --git a/test/tests/integration/composer.bats b/test/tests/integration/composer.bats index a777104..9f2e563 100644 --- a/test/tests/integration/composer.bats +++ b/test/tests/integration/composer.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh diff --git a/test/tests/integration/extensions.bats b/test/tests/integration/extensions.bats index 61f2d5b..a1e5127 100644 --- a/test/tests/integration/extensions.bats +++ b/test/tests/integration/extensions.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh diff --git a/test/tests/integration/phpinfo-php-5.3.bats b/test/tests/integration/phpinfo-apache2.2-fpm-php5.3.bats similarity index 96% rename from test/tests/integration/phpinfo-php-5.3.bats rename to test/tests/integration/phpinfo-apache2.2-fpm-php5.3.bats index a530f14..9033d5e 100644 --- a/test/tests/integration/phpinfo-php-5.3.bats +++ b/test/tests/integration/phpinfo-apache2.2-fpm-php5.3.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh @@ -12,7 +12,7 @@ payload() { "cache_dir": "/tmp/cache", "etc_dir": "/data/etc", "env_dir": "/data/etc/env.d", - "config": { "runtime": "php-5.3", "extensions": ["amqp", "dom", "timezonedb"] } + "config": { "runtime": "php-5.3", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.2" } } END } diff --git a/test/tests/integration/phpinfo-php-5.4.bats b/test/tests/integration/phpinfo-apache2.2-fpm-php5.4.bats similarity index 94% rename from test/tests/integration/phpinfo-php-5.4.bats rename to test/tests/integration/phpinfo-apache2.2-fpm-php5.4.bats index fbfb63c..99d3925 100644 --- a/test/tests/integration/phpinfo-php-5.4.bats +++ b/test/tests/integration/phpinfo-apache2.2-fpm-php5.4.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh @@ -12,7 +12,7 @@ payload() { "cache_dir": "/tmp/cache", "etc_dir": "/data/etc", "env_dir": "/data/etc/env.d", - "config": { "runtime": "php-5.4", "extensions": ["amqp", "dom", "timezonedb"] } + "config": { "runtime": "php-5.4", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.2" } } END } @@ -105,8 +105,6 @@ setup() { # cd into the app code_dir cd /tmp/code - export TEST_VARIABLE=testing - # start php-fpm # /data/bin/start-php & @@ -134,5 +132,4 @@ setup() { [[ "$output" =~ amqp ]] [[ "$output" =~ dom ]] [[ "$output" =~ timezonedb ]] - [[ "$output" =~ TEST_VARIABLE ]] } diff --git a/test/tests/integration/phpinfo-mod_php-php5.5.bats b/test/tests/integration/phpinfo-apache2.2-fpm-php5.5.bats similarity index 92% rename from test/tests/integration/phpinfo-mod_php-php5.5.bats rename to test/tests/integration/phpinfo-apache2.2-fpm-php5.5.bats index a598a30..27174de 100644 --- a/test/tests/integration/phpinfo-mod_php-php5.5.bats +++ b/test/tests/integration/phpinfo-apache2.2-fpm-php5.5.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh @@ -12,7 +12,7 @@ payload() { "cache_dir": "/tmp/cache", "etc_dir": "/data/etc", "env_dir": "/data/etc/env.d", - "config": { "runtime": "php-5.5", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php" } + "config": { "runtime": "php-5.5", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.2" } } END } @@ -105,7 +105,8 @@ setup() { # cd into the app code_dir cd /tmp/code - export TEST_VARIABLE=testing + # start php-fpm + # /data/bin/start-php & # start apache # /data/bin/start-apache & @@ -117,7 +118,10 @@ setup() { # curl the index run curl -s 127.0.0.1:8080 2>/dev/null + expected="Hello world!" + # kill the server + # pkill php-fpm # pkill httpd pkill php-server @@ -128,5 +132,4 @@ setup() { [[ "$output" =~ amqp ]] [[ "$output" =~ dom ]] [[ "$output" =~ timezonedb ]] - [[ "$output" =~ TEST_VARIABLE ]] } diff --git a/test/tests/integration/phpinfo-apache2.2-fpm-php5.6.bats b/test/tests/integration/phpinfo-apache2.2-fpm-php5.6.bats new file mode 100644 index 0000000..db70f57 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-fpm-php5.6.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.6", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.6\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-fpm-php7.0.bats b/test/tests/integration/phpinfo-apache2.2-fpm-php7.0.bats new file mode 100644 index 0000000..9b1cb53 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-fpm-php7.0.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.0", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.0\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-fpm-php7.1.bats b/test/tests/integration/phpinfo-apache2.2-fpm-php7.1.bats new file mode 100644 index 0000000..9beb050 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-fpm-php7.1.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.1", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.1\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-fpm-php7.2.bats b/test/tests/integration/phpinfo-apache2.2-fpm-php7.2.bats new file mode 100644 index 0000000..37aad20 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-fpm-php7.2.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.2", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.2\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-mod_php-php5.3.bats b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.3.bats new file mode 100644 index 0000000..a0676f7 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.3.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.3", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*5\.3\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-mod_php-php5.4.bats b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.4.bats new file mode 100644 index 0000000..61b3bf1 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.4.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.4", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*5\.4\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-mod_php-php5.5.bats b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.5.bats new file mode 100644 index 0000000..d9886db --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.5.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.5", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*5\.5\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-mod_php-php5.6.bats b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.6.bats new file mode 100644 index 0000000..2931e98 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-mod_php-php5.6.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.6", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*5\.6\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-mod_php-php7.0.bats b/test/tests/integration/phpinfo-apache2.2-mod_php-php7.0.bats new file mode 100644 index 0000000..76afbb6 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-mod_php-php7.0.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.0", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*7\.0\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-mod_php-php7.1.bats b/test/tests/integration/phpinfo-apache2.2-mod_php-php7.1.bats new file mode 100644 index 0000000..87e23be --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-mod_php-php7.1.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.1", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*7\.1\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.2-mod_php-php7.2.bats b/test/tests/integration/phpinfo-apache2.2-mod_php-php7.2.bats new file mode 100644 index 0000000..6cca3fa --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.2-mod_php-php7.2.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.2", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.2" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*7\.2\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-fpm-php5.3.bats b/test/tests/integration/phpinfo-apache2.4-fpm-php5.3.bats new file mode 100644 index 0000000..e8532a5 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-fpm-php5.3.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.3", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.3\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache-2.4.bats b/test/tests/integration/phpinfo-apache2.4-fpm-php5.4.bats similarity index 95% rename from test/tests/integration/phpinfo-apache-2.4.bats rename to test/tests/integration/phpinfo-apache2.4-fpm-php5.4.bats index 69d458e..61fe9c2 100644 --- a/test/tests/integration/phpinfo-apache-2.4.bats +++ b/test/tests/integration/phpinfo-apache2.4-fpm-php5.4.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh @@ -105,8 +105,6 @@ setup() { # cd into the app code_dir cd /tmp/code - export TEST_VARIABLE=testing - # start php-fpm # /data/bin/start-php & @@ -134,5 +132,4 @@ setup() { [[ "$output" =~ amqp ]] [[ "$output" =~ dom ]] [[ "$output" =~ timezonedb ]] - [[ "$output" =~ TEST_VARIABLE ]] } diff --git a/test/tests/integration/phpinfo-apache2.4-fpm-php5.5.bats b/test/tests/integration/phpinfo-apache2.4-fpm-php5.5.bats new file mode 100644 index 0000000..a5a55a1 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-fpm-php5.5.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.5", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.5\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-fpm-php5.6.bats b/test/tests/integration/phpinfo-apache2.4-fpm-php5.6.bats new file mode 100644 index 0000000..3e5cdac --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-fpm-php5.6.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.6", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.6\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-fpm-php7.0.bats b/test/tests/integration/phpinfo-apache2.4-fpm-php7.0.bats new file mode 100644 index 0000000..8a52a69 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-fpm-php7.0.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.0", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.0\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-fpm-php7.1.bats b/test/tests/integration/phpinfo-apache2.4-fpm-php7.1.bats new file mode 100644 index 0000000..677bf26 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-fpm-php7.1.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.1", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.1\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-fpm-php7.2.bats b/test/tests/integration/phpinfo-apache2.4-fpm-php7.2.bats new file mode 100644 index 0000000..6047bdd --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-fpm-php7.2.bats @@ -0,0 +1,135 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.2", "extensions": ["amqp", "dom", "timezonedb"], "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.2\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-mod_php-php5.3.bats b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.3.bats new file mode 100644 index 0000000..ddb79ea --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.3.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.3", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*5\.3\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-mod_php-php5.4.bats b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.4.bats new file mode 100644 index 0000000..eb7af23 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.4.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.4", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*5\.4\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-mod_php-apache-2.4.bats b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.5.bats similarity index 95% rename from test/tests/integration/phpinfo-mod_php-apache-2.4.bats rename to test/tests/integration/phpinfo-apache2.4-mod_php-php5.5.bats index 112c6ad..be0117f 100644 --- a/test/tests/integration/phpinfo-mod_php-apache-2.4.bats +++ b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.5.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh @@ -124,7 +124,7 @@ setup() { echo "$output" [[ "$output" =~ "phpinfo()" ]] - [[ "$output" =~ PHP\ Version\ 5\.5\.[0-9]{1,2} ]] + [[ "$output" =~ PHP\ Version\ .*5\.5\.[0-9]{1,2} ]] [[ "$output" =~ amqp ]] [[ "$output" =~ dom ]] [[ "$output" =~ timezonedb ]] diff --git a/test/tests/integration/phpinfo-apache2.4-mod_php-php5.6.bats b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.6.bats new file mode 100644 index 0000000..c676881 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-mod_php-php5.6.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.6", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*5\.6\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-mod_php-php7.0.bats b/test/tests/integration/phpinfo-apache2.4-mod_php-php7.0.bats new file mode 100644 index 0000000..6d06136 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-mod_php-php7.0.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.0", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*7\.0\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-mod_php-php7.1.bats b/test/tests/integration/phpinfo-apache2.4-mod_php-php7.1.bats new file mode 100644 index 0000000..6aa7413 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-mod_php-php7.1.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.1", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*7\.1\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-apache2.4-mod_php-php7.2.bats b/test/tests/integration/phpinfo-apache2.4-mod_php-php7.2.bats new file mode 100644 index 0000000..bd5f8d2 --- /dev/null +++ b/test/tests/integration/phpinfo-apache2.4-mod_php-php7.2.bats @@ -0,0 +1,132 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.2", "extensions": ["amqp", "dom", "timezonedb"], "apache_php_interpreter": "mod_php", "apache_version": "2.4" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start apache + # /data/bin/start-apache & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill httpd + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ .*7\.2\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-builtin-php5.4.bats b/test/tests/integration/phpinfo-builtin-php5.4.bats new file mode 100644 index 0000000..aa3c91a --- /dev/null +++ b/test/tests/integration/phpinfo-builtin-php5.4.bats @@ -0,0 +1,131 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.4", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "builtin" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php built-in server + # /data/bin/start-php & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill php + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.4\.[0-9]{1,2} ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-builtin-php5.5.bats b/test/tests/integration/phpinfo-builtin-php5.5.bats new file mode 100644 index 0000000..e943999 --- /dev/null +++ b/test/tests/integration/phpinfo-builtin-php5.5.bats @@ -0,0 +1,131 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.5", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "builtin" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php built-in server + # /data/bin/start-php & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill php + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.5\.[0-9]{1,2} ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-builtin-php5.6.bats b/test/tests/integration/phpinfo-builtin-php5.6.bats new file mode 100644 index 0000000..b017a6d --- /dev/null +++ b/test/tests/integration/phpinfo-builtin-php5.6.bats @@ -0,0 +1,131 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.6", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "builtin" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php built-in server + # /data/bin/start-php & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill php + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.6\.[0-9]{1,2} ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-builtin-php-7.0.bats b/test/tests/integration/phpinfo-builtin-php7.0.bats similarity index 98% rename from test/tests/integration/phpinfo-builtin-php-7.0.bats rename to test/tests/integration/phpinfo-builtin-php7.0.bats index 5307bc8..b46f96a 100644 --- a/test/tests/integration/phpinfo-builtin-php-7.0.bats +++ b/test/tests/integration/phpinfo-builtin-php7.0.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh diff --git a/test/tests/integration/phpinfo-builtin-php7.1.bats b/test/tests/integration/phpinfo-builtin-php7.1.bats new file mode 100644 index 0000000..8bc89ef --- /dev/null +++ b/test/tests/integration/phpinfo-builtin-php7.1.bats @@ -0,0 +1,131 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.1", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "builtin" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php built-in server + # /data/bin/start-php & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill php + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.1\.[0-9]{1,2} ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-builtin-php7.2.bats b/test/tests/integration/phpinfo-builtin-php7.2.bats new file mode 100644 index 0000000..fb6a9b4 --- /dev/null +++ b/test/tests/integration/phpinfo-builtin-php7.2.bats @@ -0,0 +1,131 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.2", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "builtin" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php built-in server + # /data/bin/start-php & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + # kill the server + # pkill php + pkill php-server + + echo "$output" + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.2\.[0-9]{1,2} ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-nginx-php5.3.bats b/test/tests/integration/phpinfo-nginx-php5.3.bats new file mode 100644 index 0000000..2d455f9 --- /dev/null +++ b/test/tests/integration/phpinfo-nginx-php5.3.bats @@ -0,0 +1,141 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.3", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "nginx" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-nginx & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill nginx + pkill php-server + + echo "$output" + echo + + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.3\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + # doesn't seem to work for php 5.3 + # [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-nginx-php5.4.bats b/test/tests/integration/phpinfo-nginx-php5.4.bats new file mode 100644 index 0000000..5039a0b --- /dev/null +++ b/test/tests/integration/phpinfo-nginx-php5.4.bats @@ -0,0 +1,140 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.4", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "nginx" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-nginx & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill nginx + pkill php-server + + echo "$output" + echo + + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.4\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-nginx-php5.5.bats b/test/tests/integration/phpinfo-nginx-php5.5.bats new file mode 100644 index 0000000..02c56c2 --- /dev/null +++ b/test/tests/integration/phpinfo-nginx-php5.5.bats @@ -0,0 +1,140 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-5.5", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "nginx" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-nginx & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill nginx + pkill php-server + + echo "$output" + echo + + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 5\.5\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-nginx-php5.6.bats b/test/tests/integration/phpinfo-nginx-php5.6.bats index 4e92954..1143ef8 100644 --- a/test/tests/integration/phpinfo-nginx-php5.6.bats +++ b/test/tests/integration/phpinfo-nginx-php5.6.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh diff --git a/test/tests/integration/phpinfo-nginx-php7.0.bats b/test/tests/integration/phpinfo-nginx-php7.0.bats new file mode 100644 index 0000000..767bd24 --- /dev/null +++ b/test/tests/integration/phpinfo-nginx-php7.0.bats @@ -0,0 +1,140 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.0", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "nginx" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-nginx & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill nginx + pkill php-server + + echo "$output" + echo + + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.0\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-nginx-php7.1.bats b/test/tests/integration/phpinfo-nginx-php7.1.bats new file mode 100644 index 0000000..1ab0e74 --- /dev/null +++ b/test/tests/integration/phpinfo-nginx-php7.1.bats @@ -0,0 +1,140 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.1", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "nginx" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-nginx & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill nginx + pkill php-server + + echo "$output" + echo + + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.1\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo-nginx-php7.2.bats b/test/tests/integration/phpinfo-nginx-php7.2.bats new file mode 100644 index 0000000..aca430e --- /dev/null +++ b/test/tests/integration/phpinfo-nginx-php7.2.bats @@ -0,0 +1,140 @@ +# Integration test for a simple php app + +# source environment helpers +. util/env.sh + +payload() { + cat <<-END +{ + "code_dir": "/tmp/code", + "data_dir": "/data", + "app_dir": "/tmp/app", + "cache_dir": "/tmp/cache", + "etc_dir": "/data/etc", + "env_dir": "/data/etc/env.d", + "config": { "runtime": "php-7.2", "extensions": ["amqp", "dom", "timezonedb"], "webserver": "nginx" } +} +END +} + +setup() { + # cd into the engine bin dir + cd /engine/bin +} + +@test "setup" { + # prepare environment (create directories etc) + prepare_environment + + # prepare pkgsrc + run prepare_pkgsrc + + # create the code_dir + mkdir -p /tmp/code + + # copy the app into place + cp -ar /test/apps/phpinfo/* /tmp/code + + run pwd + + [ "$output" = "/engine/bin" ] +} + +@test "boxfile" { + if [[ ! -f /engine/bin/boxfile ]]; then + skip "No boxfile script" + fi + run /engine/bin/boxfile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "build" { + if [[ ! -f /engine/bin/build ]]; then + skip "No build script" + fi + run /engine/bin/build "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "compile" { + if [[ ! -f /engine/bin/compile ]]; then + skip "No compile script" + fi + run /engine/bin/compile "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "cleanup" { + if [[ ! -f /engine/bin/cleanup ]]; then + skip "No cleanup script" + fi + run /engine/bin/cleanup "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "release" { + if [[ ! -f /engine/bin/release ]]; then + skip "No release script" + fi + run /engine/bin/release "$(payload)" + + echo "$output" + + [ "$status" -eq 0 ] +} + +@test "verify" { + # remove the code dir + rm -rf /tmp/code + + # mv the app_dir to code_dir + mv /tmp/app /tmp/code + + # cd into the app code_dir + cd /tmp/code + + export TEST_VARIABLE=testing + + # start php-fpm + # /data/bin/start-php & + + # start apache + # /data/bin/start-nginx & + php-server & + + # sleep a few seconds so the server can start + sleep 3 + + # curl the index + run curl -s 127.0.0.1:8080 2>/dev/null + + expected="Hello world!" + + # kill the server + # pkill php-fpm + # pkill nginx + pkill php-server + + echo "$output" + echo + + + [[ "$output" =~ "phpinfo()" ]] + [[ "$output" =~ PHP\ Version\ 7\.2\.[0-9]{1,2} ]] + [[ "$output" =~ amqp ]] + [[ "$output" =~ dom ]] + [[ "$output" =~ timezonedb ]] + [[ "$output" =~ TEST_VARIABLE ]] +} diff --git a/test/tests/integration/phpinfo.bats b/test/tests/integration/phpinfo.bats deleted file mode 100644 index 72cfb10..0000000 --- a/test/tests/integration/phpinfo.bats +++ /dev/null @@ -1,130 +0,0 @@ -# Integration test for a simple go app - -# source environment helpers -. util/env.sh - -payload() { - cat <<-END -{ - "code_dir": "/tmp/code", - "data_dir": "/data", - "app_dir": "/tmp/app", - "cache_dir": "/tmp/cache", - "etc_dir": "/data/etc", - "env_dir": "/data/etc/env.d", - "config": {} -} -END -} - -setup() { - # cd into the engine bin dir - cd /engine/bin -} - -@test "setup" { - # prepare environment (create directories etc) - prepare_environment - - # prepare pkgsrc - run prepare_pkgsrc - - # create the code_dir - mkdir -p /tmp/code - - # copy the app into place - cp -ar /test/apps/phpinfo/* /tmp/code - - run pwd - - [ "$output" = "/engine/bin" ] -} - -@test "boxfile" { - if [[ ! -f /engine/bin/boxfile ]]; then - skip "No boxfile script" - fi - run /engine/bin/boxfile "$(payload)" - - echo "$output" - - [ "$status" -eq 0 ] -} - -@test "build" { - if [[ ! -f /engine/bin/build ]]; then - skip "No build script" - fi - run /engine/bin/build "$(payload)" - - echo "$output" - - [ "$status" -eq 0 ] - [ -f /data/etc/profile.d/php.sh ] -} - -@test "compile" { - if [[ ! -f /engine/bin/compile ]]; then - skip "No compile script" - fi - run /engine/bin/compile "$(payload)" - - echo "$output" - - [ "$status" -eq 0 ] -} - -@test "cleanup" { - if [[ ! -f /engine/bin/cleanup ]]; then - skip "No cleanup script" - fi - run /engine/bin/cleanup "$(payload)" - - echo "$output" - - [ "$status" -eq 0 ] -} - -@test "release" { - if [[ ! -f /engine/bin/release ]]; then - skip "No release script" - fi - run /engine/bin/release "$(payload)" - - echo "$output" - - [ "$status" -eq 0 ] -} - -@test "verify" { - # remove the code dir - rm -rf /tmp/code - - # mv the app_dir to code_dir - mv /tmp/app /tmp/code - - # cd into the app code_dir - cd /tmp/code - - # start php-fpm - # /data/bin/start-php & - - # start apache - # /data/bin/start-apache & - php-server & - - # sleep a few seconds so the server can start - sleep 3 - - # curl the index - run curl -s 127.0.0.1:8080 2>/dev/null - - # kill the server - # pkill php-fpm - # pkill httpd - pkill php-server - - echo "$output" - - [[ "$output" =~ "phpinfo()" ]] -} diff --git a/test/tests/integration/unique-extensions.bats b/test/tests/integration/unique-extensions.bats index f49d3c5..ecb74e2 100644 --- a/test/tests/integration/unique-extensions.bats +++ b/test/tests/integration/unique-extensions.bats @@ -1,4 +1,4 @@ -# Integration test for a simple go app +# Integration test for a simple php app # source environment helpers . util/env.sh @@ -12,7 +12,7 @@ payload() { "cache_dir": "/tmp/cache", "etc_dir": "/data/etc", "env_dir": "/data/etc/env.d", - "config": {"runtime": "php-5.6", "extensions": ["json","json","json","json","json","xmlwriter","xml"],"zend_extensions":["xcache","xcache"],"dev_extensions":{"add":["geoip", "geoip"],"rm":["mongo"]},"dev_zend_extensions":{"add":["xdebug", "xdebug"],"rm":["xcache"]}} + "config": {"runtime": "php-5.6", "extensions": ["json","json","json","json","json","xmlwriter","xml"],"zend_extensions":["xcache","xcache"],"dev_extensions":{"add":["geoip", "geoip"],"rm":["mongo"]},"dev_zend_extensions":{"add":["xdebug", "xdebug"],"rm":["xcache"]}, "apache_version": "2.2"} } END }