diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b903ecb9f2fa4f7c3f7e1d288a96e1b15ed1bbe2..b4cb55249b94cb36d463d3ada1991abf7031d8c8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,13 @@ include: "https://git.autistici.org/pipelines/containers/raw/master/common.yml" -# test the newly built container before releasing it. +# Test the newly built container before releasing it. +# +# Use "float-podman-runner" to set up a rootless container like 'float' does. +# Use "ai3/testdata" to populate a MySQL database that looks like the real +# noblogs.org, and finally run some HTTP tests (in docker/test.sh). +# NOTE: The database configuration (docker/test-config.json) does not match +# production as there is no sharding, instead everything is stored in the +# main 'noblogs' database. test: stage: container-test image: registry.git.autistici.org/pipelines/images/test/float-podman-runner:master @@ -12,7 +19,8 @@ test: tags: [podman] variables: APACHE_PORT: 8080 - SITE_URL: "http://localhost:8080" + TARGET_URL: "http://localhost:8080" + TARGET_ADDR: "127.0.0.1:8080" MYSQL_DATABASE: noblogs MYSQL_ROOT_PASSWORD: rootpass before_script: @@ -21,5 +29,6 @@ test: - dnf install -y mysql xz git - git clone --depth=1 https://gitlab-ci-token:${CI_JOB_TOKEN}@git.autistici.org/ai3/testdata.git /tmp/testdata.$CI_JOB_ID - xzcat /tmp/testdata.$CI_JOB_ID/noblogs/noblogs.sql.xz | mysql --user=root --password=rootpass --host=mysql noblogs + - for blog in cavallette detriti docs ; do xzcat /tmp/testdata.$CI_JOB_ID/noblogs/noblogs_${blog}.sql.xz | mysql --user=root --password=rootpass --host=mysql noblogs; done - with-container --expose=8080 --mount=type=bind,source=docker/test-config.json,destination=/etc/noblogs/config.json --mount=type=tmpfs,destination=/opt/noblogs/www/wp-content/blogs.dir --mount=type=tmpfs,destination=/opt/noblogs/www/wp-content/cache $IMAGE_TAG ./docker/test.sh diff --git a/docker/test.sh b/docker/test.sh index 55dcaed17821b2de2f784e2fe7dffd44b2b07191..55ab1657e130e62a7c89bea9013a1335559a88d4 100755 --- a/docker/test.sh +++ b/docker/test.sh @@ -1,4 +1,4 @@ #!/bin/sh -exec curl -H 'Host: noblogs.org' -v -s ${SITE_URL}/ +exec curl -H 'X-Forwarded-Proto: https' -H 'Host: noblogs.org' -v -s ${TARGET_URL}/