ci: add a basic smoke test check#174
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a basic smoke test to the pull request CI workflow. After successfully building the Docker image, the new steps start the container, poll the HTTP endpoint until it's ready (up to 60 seconds), verify that four required PHP extensions are loaded, and clean up the container regardless of outcome. This complements the existing lint and build checks to give earlier signal that the produced image is functional.
Changes:
- The build step now loads the image locally (changed from
load: falsetoload: true) and assigns a tag so it can be referenced by later steps. - A "Smoke test image" step runs the container, polls the HTTP endpoint with retries, and checks that
gd,ldap,mysqli, andtimezonedbPHP modules are present. - "Dump smoke logs on failure" and "Cleanup smoke container" housekeeping steps are added.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
49ed359 to
edb6afd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| docker cp librebooking-smoke-src:/var/www/html/database_schema /tmp/librebooking-database_schema | ||
| docker rm librebooking-smoke-src | ||
|
|
||
| cat \ |
There was a problem hiding this comment.
Given what you are testing, I am not sure you needto create the database
There was a problem hiding this comment.
Without a database Librebooking will give an error message when trying to access it.
There was a problem hiding this comment.
This is odd.
When I run librebooking without any sql container, I don't have any issue.
robin@trixie-dev:~$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7179644bd62f librebooking:4.2.0 "/usr/local/bin/entr…" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp librebooking-app-1
robin@trixie-dev:~$ curl --silent --show-error --fail --max-time 2 http://localhost:8080
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://localhost:8080/Web/">here</a>.</p>
<hr>
<address>Apache/2.4.66 (Debian) Server at localhost Port 8080</address>
</body></html>
Please note that the URL is http://localhost:8080 when I run from my laptop
There was a problem hiding this comment.
But when you go to http://localhost:8080/Web/ it will give a 500 😢 if no SQL.
All that is testing is .htaccess is working.
| /tmp/librebooking-database_schema/create-schema.sql \ | ||
| | docker exec --interactive "${mysql_service_id}" mysql --user root --password=root | ||
|
|
||
| docker run --rm \ |
There was a problem hiding this comment.
Without a database Librebooking will give an error message when trying to access it.
| "${image_tag}" | ||
|
|
||
| for attempt in $(seq 1 30); do | ||
| if curl --silent --show-error --fail --max-time 2 http://127.0.0.1:18080/Web/; then |
There was a problem hiding this comment.
I would curl the /web/install URL path, instead.
In a future release, I would investigate the utilization of web page test automation tools, such as Playwright.
Please note that upstream could benefit from such tools.
There was a problem hiding this comment.
Why is /Web/install better?
Playwright looks interesting. I would like a LOT more actual testing of the app in the upstream project.
edb6afd to
95aebb6
Compare
95aebb6 to
685b69a
Compare
This runs the docker image and attempts to connect to it.
685b69a to
03150d6
Compare
This runs the docker image and attempts to connect to it.