Skip to content

Commit 8b84316

Browse files
committed
added curl package
added container test
1 parent ace9576 commit 8b84316

6 files changed

Lines changed: 38 additions & 7 deletions

File tree

.drone.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ trigger:
3737
- success
3838

3939
steps:
40-
- name: base_node_test
40+
- name: base_php_test
4141
image: fabiodcorreia/base-php:test
42+
ports: [ 80 ]
43+
detach: true
4244
pull: always
4345
environment:
4446
PUID: "1000"
4547
PGID: "1000"
48+
49+
- name: test image
50+
image: python:2.7.18-alpine
4651
commands:
4752
- sleep 60
4853
- sh ./test/start.sh

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ LABEL maintainer="fabiodcorreia"
88

99
RUN \
1010
echo "**** install runtime packages ****" && \
11-
apk add --no-cache nginx \
11+
apk add --no-cache \
12+
curl \
13+
nginx \
1214
php7 \
1315
php7-fileinfo \
1416
php7-fpm \

package_versions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ busybox-1.31.1-r19
77
ca-certificates-20191127-r4
88
ca-certificates-bundle-20191127-r4
99
coreutils-8.32-r0
10+
curl-7.70.0-r2
1011
libacl-2.2.53-r0
1112
libattr-2.4.48-r0
1213
libc-utils-0.7.2-r3

test/main.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import sys
2+
import os
3+
import mechanize
4+
5+
APP_TEST_PORT = "80"
6+
7+
assert len(sys.argv) > 1, "no arguments"
8+
9+
APP_TEST_URL = sys.argv[1]
10+
11+
print("TEST_ULR=" + APP_TEST_URL)
12+
13+
br = mechanize.Browser()
14+
br.set_handle_robots(False)
15+
16+
response = br.open(APP_TEST_URL)
17+
assert response.code == 200, "response code is not 200"
18+
assert br.title == "PHP 7.3.19 - phpinfo()"

test/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mechanize

test/start.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/bin/bash
22

3-
INDEX=`curl -s localhost | grep "PHP 7.3.19 - phpinfo()" | wc -l`
3+
pip install -r ./test/requirements.txt
44

5-
if [ $INDEX != 1 ]; then
6-
echo "**** Index with PHP Info not found ****"
7-
exit 1
8-
fi
5+
IP=`ping base_php_test -c 1 -s 16 | grep -o '([^ ]*' | grep -m1 "" | grep -o '([^ ]*' | tr -d '(:)'`
6+
7+
echo "base_php_test = $IP"
8+
9+
APP_TEST_URL="http://$IP"
10+
APP_TEST_PORT="80"
11+
12+
python ./test/main.py $APP_TEST_URL $APP_TEST_PORT

0 commit comments

Comments
 (0)