Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/generic_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
run-tests:
name: 'Test'
runs-on: ubuntu-20.04
strategy:
matrix:
part: [serial, parallel/set1, parallel/set2, parallel/set3]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -45,6 +48,6 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache

- name: 'Run tests'
run: make generate-accounts tests
run: make generate-accounts tests/${{ matrix.part }}
env:
CI: true
39 changes: 29 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
SHELL := /bin/bash
.SHELLFLAGS += -e -u -o pipefail
SHELL := /bin/bash
.SHELLFLAGS += -e -u -o pipefail

export IMAGE_NAME := mailserver-testing:ci
export NAME ?= $(IMAGE_NAME)
PARALLEL_JOBS ?= 2
export REPOSITORY_ROOT := $(CURDIR)
Comment thread
polarathene marked this conversation as resolved.
export IMAGE_NAME ?= mailserver-testing:ci
export NAME ?= $(IMAGE_NAME)
Comment thread
polarathene marked this conversation as resolved.

.PHONY: ALWAYS_RUN
Comment thread
georglauterbach marked this conversation as resolved.

# -----------------------------------------------
# --- Generic Targets ---------------------------
Expand All @@ -17,7 +21,7 @@ build:
--build-arg VCS_REVISION=$(shell cat VERSION) \
.

generate-accounts:
generate-accounts: ALWAYS_RUN
@ cp test/config/templates/postfix-accounts.cf test/config/postfix-accounts.cf
@ cp test/config/templates/dovecot-masters.cf test/config/dovecot-masters.cf

Expand All @@ -33,14 +37,29 @@ clean:
-@ while read -r LINE; do [[ $${LINE} =~ test/.+ ]] && sudo rm -rf $${LINE}; done < .gitignore

# -----------------------------------------------
# --- Tests & Lints ----------------------------
# --- Tests ------------------------------------
# -----------------------------------------------

tests:
@ ./test/bats/bin/bats --timing test/*.bats
tests: ALWAYS_RUN
# See https://github.com/docker-mailserver/docker-mailserver/pull/2857#issuecomment-1312724303
# on why `generate-accounts` is run before each set (TODO/FIXME)
@ $(MAKE) generate-accounts tests/serial
@ $(MAKE) generate-accounts tests/parallel/set1
@ $(MAKE) generate-accounts tests/parallel/set2
@ $(MAKE) generate-accounts tests/parallel/set3

tests/serial: ALWAYS_RUN
@ shopt -s globstar ; ./test/bats/bin/bats --timing --jobs 1 test/$@/**.bats

tests/parallel/set%: ALWAYS_RUN
@ shopt -s globstar ; ./test/bats/bin/bats --timing --jobs $(PARALLEL_JOBS) test/$@/**.bats

test/%:
@ ./test/bats/bin/bats --timing [email protected]
test/%: ALWAYS_RUN
@ shopt -s globstar nullglob ; ./test/bats/bin/bats --timing test/tests/**/{$*,}.bats
Comment thread
georglauterbach marked this conversation as resolved.

# -----------------------------------------------
# --- Lints -------------------------------------
# -----------------------------------------------

lint: eclint hadolint shellcheck

Expand Down
6 changes: 6 additions & 0 deletions docs/content/contributing/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ To run the test suite, you will need to

We do not support running linting, tests, etc on macOS at this time. Please use a linux VM.

??? tip "Running a Specific Test"

To run a specific test, use `make build generate-accounts test/<TEST NAME>`, where `<TEST NAME>` is the file name of the test (_for more precision use a relative path: `test/test/<PATH>`_) excluding the `.bats` suffix.

To run only the tests in `template.bats`, use `make test/template` (or `make test/parallel/set2/template`).

[Install Docker]: https://docs.docker.com/get-docker/

## Documentation
Expand Down
79 changes: 0 additions & 79 deletions test/clamav.bats

This file was deleted.

28 changes: 0 additions & 28 deletions test/default_relay_host.bats

This file was deleted.

54 changes: 0 additions & 54 deletions test/dovecot_inet_protocol.bats

This file was deleted.

30 changes: 0 additions & 30 deletions test/helper-functions.bats

This file was deleted.

Loading