From 472174b744246f0448cfd965f855af5ea9784f10 Mon Sep 17 00:00:00 2001 From: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Date: Sun, 3 Dec 2023 22:28:40 +0100 Subject: [PATCH] ci: add `run-local-instance` target to `Makefile` (#3663) --- CHANGELOG.md | 4 ++++ Makefile | 16 ++++++++++++++++ docs/content/contributing/tests.md | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7fdb981..e6faa74a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. The format > **Note**: Changes and additions listed here are contained in the `:edge` image tag. These changes may not be as stable as released changes. +### Added + +- command (`run-local-instance`) to test a version of DMS that was built locally to test changes + ### Fixed - **Internal**: diff --git a/Makefile b/Makefile index 0962c11a..37267d2c 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,22 @@ clean: ALWAYS_RUN -@ while read -r LINE; do [[ $${LINE} =~ test/.+ ]] && FILES+=("/mnt$${LINE#test}"); done < .gitignore ; \ docker run --rm -v "$(REPOSITORY_ROOT)/test/:/mnt" alpine ash -c "rm -rf $${FILES[@]}" +run-local-instance: ALWAYS_RUN + bash -c 'sleep 8 ; ./setup.sh email add postmaster@example.test 123' & + docker run --rm --interactive --tty --name dms-test_example \ + --env OVERRIDE_HOSTNAME=mail.example.test \ + --env POSTFIX_INET_PROTOCOLS=ipv4 \ + --env DOVECOT_INET_PROTOCOLS=ipv4 \ + --env ENABLE_CLAMAV=0 \ + --env ENABLE_AMAVIS=0 \ + --env ENABLE_RSPAMD=0 \ + --env ENABLE_OPENDKIM=0 \ + --env ENABLE_OPENDMARC=0 \ + --env ENABLE_POLICYD_SPF=0 \ + --env ENABLE_SPAMASSASSIN=0 \ + --env LOG_LEVEL=trace \ + $(IMAGE_NAME) + # ----------------------------------------------- # --- Tests ------------------------------------ # ----------------------------------------------- diff --git a/docs/content/contributing/tests.md b/docs/content/contributing/tests.md index 6f649529..8816a228 100644 --- a/docs/content/contributing/tests.md +++ b/docs/content/contributing/tests.md @@ -78,6 +78,10 @@ We use `make` to run commands. When writing tests, ensure that parallel set tests still pass when run in parallel. You need to account for other tests running in parallel that may interfere with your own tests logic. +!!! tip + + You may use `make run-local-instance` to run a version of the image built locally to test and edit your changes in a running DMS instance. + ### An Example In this example, you've made a change to the Rspamd feature support (_or adjusted it's tests_). First verify no regressions have been introduced by running it's specific test file: