Skip to content

Commit 02ab01b

Browse files
committed
Implement test with bash_unit
1 parent 4f33616 commit 02ab01b

28 files changed

+970
-259
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
.idea
2-
tmp
1+
.idea

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ test-quick: ## Test 8.0 and 8.1 quickly
1616
test-8.1: ## Test php8.1 build only
1717
VERSION=8.1 VARIANT=cli $(MAKE) _test-version
1818
VERSION=8.1 VARIANT=apache $(MAKE) _test-version
19+
VERSION=8.1 VARIANT=fpm $(MAKE) _test-version
1920

2021
test-8.0: ## Test php8.0 build only
2122
VERSION=8.0 VARIANT=cli $(MAKE) _test-version
2223
VERSION=8.0 VARIANT=apache $(MAKE) _test-version
24+
VERSION=8.0 VARIANT=fpm $(MAKE) _test-version
2325

2426
_test-version: _test-prerequisites ## Test php build for VERSION="" and VARIANT=""
2527
docker buildx bake --load \
2628
--set "*.platform=$$(uname -p)" \
27-
php$${VERSION//.}-cli
28-
PHP_VERSION="$(VERSION)" BRANCH=v4 VARIANT=cli ./test-image.sh || (notify-send -u critical "Tests failed ($(VERSION)-$(VARIANT))" && exit 1)
29+
php$${VERSION//.}-$(VARIANT)-all
30+
PHP_VERSION="$(VERSION)" BRANCH=v4 VARIANT=$(VARIANT) ./tests-suite/bash_unit -f tap ./tests-suite/*.sh || (notify-send -u critical "Tests failed ($(VERSION)-$(VARIANT))" && exit 1)
2931
notify-send -u critical "Tests passed with success ($(VERSION)-$(VARIANT))"
3032

3133
clean: ## Clean dangles image after build

test-image.sh

Lines changed: 0 additions & 225 deletions
This file was deleted.

tests-suite/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Test suite
2+
3+
These tests use bash_unit to allow a clean visualisation of tests.
4+
This file describe some features used here.
5+
6+
## `./config` file
7+
8+
This file allow the test suite to have some variables / command already set. You can customize.
9+
10+
## Setup/teardown
11+
12+
Like any regular test unit process, you can play command at initialisation of the test, and other at this end. It's used to generate fake directories or start docker commands. The teardown allow to clean directory/started container but if any fatal error happens (or `ctrl+c`), the tear down if not played. So you can have unwanted container started (you need to clean them manually, but it's not require to clean to re-execute because port/name/directory are random and uniq for each test suite).
13+
14+
## Pipe to `/dev/null`
15+
16+
Lot of command display result, error, warning. All are forward to /dev/null when it's not relevant (only the exit code is used `$?`). It's maybe usefull to provide a full log on these cases if it's possible to find a solution for that.
17+
18+
## Uncommon command `tail -n +1`
19+
20+
When there is comparaison with grep, it's required to prefix by ` | tail -n +1`. It's do nothing at all (only display from the first line to the end) but avoid this warning "write /dev/stdout: broken pipe" if command make too long time for response (required for arm64 testing).
21+
22+
## `[[ $VARIANT != apache* ]]`
23+
24+
Some part of the test is not depend on variant of image. Per example here, apache. It's maybe useful to find another way to just ignore the test instead of `exit 0` the full file (bash unit do not manage that currently).
25+
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/composer/Dockerfile renamed to tests-suite/assets/composer/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
ARG BRANCH
22
ARG BRANCH_VARIANT
33
ARG PHP_VERSION
4+
ARG REPO
5+
ARG TAG_PREFIX
46

5-
FROM thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}
7+
FROM ${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}
68

79
ENV PHP_EXTENSION_GD=1
810

File renamed without changes.

0 commit comments

Comments
 (0)