Skip to content

Commit 870f3c5

Browse files
committed
DB Testing: Updated supported DB list, added readme
Also fixed potentally flaky GIf test to be more accurate with single frame GIF images.
1 parent 22a7772 commit 870f3c5

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

dev/docker/db-testing/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ ARG BRANCH=development
1919
# Download BookStack & install PHP deps
2020
RUN mkdir -p /var/www && \
2121
git clone https://github.com/bookstackapp/bookstack.git --branch "$BRANCH" --single-branch /var/www/bookstack && \
22-
cd /var/www/bookstack && \
23-
wget https://raw.githubusercontent.com/composer/getcomposer.org/f3108f64b4e1c1ce6eb462b159956461592b3e3e/web/installer -O - -q | php -- --quiet --filename=composer && \
22+
cd /var/www/bookstack && \
23+
wget https://raw.githubusercontent.com/composer/getcomposer.org/f3108f64b4e1c1ce6eb462b159956461592b3e3e/web/installer -O - -q | php -- --quiet --filename=composer && \
2424
php composer install
2525

2626
# Set the BookStack dir as the default working dir

dev/docker/db-testing/readme.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Database Testing Suite
2+
3+
This docker setup is designed to run BookStack's test suite against each major database version we support
4+
across MySQL and MariaDB to ensure compatibility and highlight any potential issues before a release.
5+
This is a fairly slow and heavy process, so is designed to just be run manually before a release which
6+
makes changes to the database schema, or a release which makes significant changes to database queries.
7+
8+
### Running
9+
10+
Everything is ran via the `run.sh` script. This will:
11+
12+
- Optionally, accept a branch of BookStack to use for testing.
13+
- Build the docker image from the `Dockerfile`.
14+
- This will include a built-in copy of the chosen BookStack branch.
15+
- Cycle through each major supported database version:
16+
- Migrate and seed the database.
17+
- Run the full PHP test suite.
18+
19+
If there's a failure for a database version, the script will prompt if you'd like to continue or stop testing.
20+
21+
This script should be ran from this `db-testing` directory:
22+
23+
```bash
24+
# Enter this directory
25+
cd dev/docker/db-testing
26+
27+
# Runs for the 'development' branch by default
28+
./run.sh
29+
30+
# Run for a specific branch
31+
./run.sh v25-11
32+
```

dev/docker/db-testing/run.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ fi
1111

1212
# List of database containers to test against
1313
containers=(
14-
"mysql:5.7"
1514
"mysql:8.0"
1615
"mysql:8.4"
1716
"mysql:9.5"
18-
"mariadb:10.2"
1917
"mariadb:10.6"
2018
"mariadb:10.11"
2119
"mariadb:11.4"

tests/Uploads/ImageTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,15 +720,15 @@ public function test_gif_thumbnail_generation()
720720
$galleryFileSize = filesize($galleryThumbPath);
721721

722722
// Basic scan of GIF content to check frame count
723-
$originalFrameCount = count(explode("\x00\x21\xF9", file_get_contents($originalFile)));
724-
$galleryFrameCount = count(explode("\x00\x21\xF9", file_get_contents($galleryThumbPath)));
723+
$originalFrameCount = count(explode("\x00\x21\xF9", file_get_contents($originalFile))) - 1;
724+
$galleryFrameCount = count(explode("\x00\x21\xF9", file_get_contents($galleryThumbPath))) - 1;
725725

726726
$this->files->deleteAtRelativePath($relPath);
727727
$this->files->deleteAtRelativePath($galleryThumbRelPath);
728728

729729
$this->assertNotEquals($originalFileSize, $galleryFileSize);
730-
$this->assertEquals(3, $originalFrameCount);
731-
$this->assertEquals(1, $galleryFrameCount);
730+
$this->assertEquals(2, $originalFrameCount);
731+
$this->assertLessThan(2, $galleryFrameCount);
732732
}
733733

734734
protected function getTestProfileImage()

0 commit comments

Comments
 (0)