Skip to content

Commit

Permalink
Run tests for apache and nginx
Browse files Browse the repository at this point in the history
Some of these are failing, but that's alright. Fixes coming up
  • Loading branch information
alexbakker committed Mar 3, 2024
1 parent 75cd81b commit 1443e9b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cache: 'gradle'
- name: Start WebDAV servers
run: |
cd tests && docker compose up -d --wait --force-recreate --build --renew-anon-volumes --remove-orphans
cd tests && docker compose --project-directory tests up -d --wait --force-recreate --build --renew-anon-volumes --remove-orphans
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
Expand Down
10 changes: 9 additions & 1 deletion app/src/androidTest/java/me/alexbakker/webdav/WebDavTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ class WebDavTest(private val testName: String, private val account: Account) {
username = "test",
password = "test"
)),
arrayOf("apache", Account(
name = "Test",
url = "http://${HOST}:8004",
)),
arrayOf("nginx", Account(
name = "Test",
url = "http://${HOST}:8002",
)),
)
}
}
Expand All @@ -77,7 +85,7 @@ class WebDavTest(private val testName: String, private val account: Account) {
private fun resetEnvironment() {
val req = Request.Builder()
.post(EMPTY_REQUEST)
.url("http://${HOST}:8000/reset/hacdias")
.url("http://${HOST}:8000/reset/${testName}")
.build()
val res = httpClient.newCall(req).execute()
assertThat(res.code, equalTo(200))
Expand Down
7 changes: 7 additions & 0 deletions tests/controller/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

umask 002

populate_dir() {
mkdir -p "$1"
head -c 1000000 < /dev/urandom > "$1/1.bin"
Expand All @@ -10,6 +12,11 @@ populate_dir() {
}

WEBDAV_DIR="$1"
if [ ! -d "${WEBDAV_DIR}"]; then
echo "No such directory: ${WEBDAV_DIR}"
exit 1
fi

find "${WEBDAV_DIR}" -mindepth 1 -delete

populate_dir "${WEBDAV_DIR}"
Expand Down
1 change: 1 addition & 0 deletions tests/servers/apache/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
DATA_DIR="/dav/apache"
mkdir -p "${DATA_DIR}"
chown -R daemon:daemon "${DATA_DIR}"
chmod g+s "${DATA_DIR}"
ln -s "${DATA_DIR}" /data
exec httpd-foreground
1 change: 0 additions & 1 deletion tests/servers/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ FROM alpine:3
COPY ./run.sh /
COPY ./default.conf /etc/nginx/http.d/default.conf
RUN apk add curl nginx nginx-mod-http-dav-ext
RUN mkdir /data
CMD ["./run.sh"]
EXPOSE 80
2 changes: 2 additions & 0 deletions tests/servers/nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ server {
location / {
root /data;
autoindex on;
access_log /dev/stdout;
error_log /dev/stdout;
client_max_body_size 1g;
create_full_put_path off;
dav_methods PUT DELETE MKCOL COPY MOVE;
Expand Down
5 changes: 3 additions & 2 deletions tests/servers/nginx/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

DATA_DIR="/dav/nginx"
mkdir -p "${DATA_DIR}"
chown -R www-data:www-data "${DATA_DIR}"
chown -R nginx:nginx "${DATA_DIR}"
chmod g+s "${DATA_DIR}"
ln -s "${DATA_DIR}" /data

exec nginx -g "daemon off;"
exec nginx -g "daemon off;error_log /dev/stdout info;"

0 comments on commit 1443e9b

Please sign in to comment.