mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
[Backport release-26.05] nixos/tests/flarum: init (#537285)
This commit is contained in:
commit
6a61674c2b
3 changed files with 56 additions and 0 deletions
|
|
@ -598,6 +598,7 @@ in
|
|||
flannel = runTestOn [ "x86_64-linux" ] ./flannel.nix;
|
||||
flap-alerted = runTest ./flap-alerted.nix;
|
||||
flaresolverr = runTest ./flaresolverr.nix;
|
||||
flarum = runTest ./flarum.nix;
|
||||
flood = runTest ./flood.nix;
|
||||
fluent-bit = runTest ./fluent-bit.nix;
|
||||
fluentd = runTest ./fluentd.nix;
|
||||
|
|
|
|||
52
nixos/tests/flarum.nix
Normal file
52
nixos/tests/flarum.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
name = "flarum";
|
||||
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [
|
||||
fsagbuya
|
||||
jasonodoom
|
||||
];
|
||||
};
|
||||
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
{
|
||||
# Flarum installs and migrates the database on first boot and runs a
|
||||
# MariaDB server alongside PHP-FPM and nginx, so give the VM some headroom.
|
||||
virtualisation.memorySize = 2048;
|
||||
|
||||
services.flarum = {
|
||||
enable = true;
|
||||
forumTitle = "NixOS Flarum Test Forum";
|
||||
domain = "localhost";
|
||||
baseUrl = "http://localhost";
|
||||
|
||||
# Run `flarum install` against the locally provisioned MariaDB. Safe here
|
||||
# because the VM always starts from a fresh, empty database.
|
||||
createDatabaseLocally = true;
|
||||
|
||||
adminUser = "admin";
|
||||
adminEmail = "admin@example.com";
|
||||
# Flarum rejects admin passwords shorter than 8 characters.
|
||||
initialAdminPassword = "flarum-admin-password";
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
# PHP-FPM is ordered after the oneshot installer (Type=oneshot, no
|
||||
# RemainAfterExit), so waiting on it implies the install/migrate finished.
|
||||
machine.wait_for_unit("phpfpm-flarum.service")
|
||||
machine.wait_for_unit("nginx.service")
|
||||
machine.wait_for_open_port(80)
|
||||
|
||||
# The forum front page is server-rendered and embeds the configured title.
|
||||
machine.wait_until_succeeds("curl -sf http://localhost/ -o /dev/null")
|
||||
machine.succeed("curl -sf http://localhost/ | grep -F 'NixOS Flarum Test Forum'")
|
||||
|
||||
# The admin API endpoint should respond, confirming the app booted cleanly.
|
||||
machine.succeed("curl -sf http://localhost/api -o /dev/null")
|
||||
'';
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
lib,
|
||||
php,
|
||||
fetchFromGitHub,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
php.buildComposerProject2 (finalAttrs: {
|
||||
|
|
@ -19,6 +20,8 @@ php.buildComposerProject2 (finalAttrs: {
|
|||
composerStrictValidation = false;
|
||||
vendorHash = "sha256-EHl+Mr6y5A51EpLPAWUGtiPkLOky6KvsSY4JWHeyO28=";
|
||||
|
||||
passthru.tests.module = nixosTests.flarum;
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/flarum/framework/blob/main/CHANGELOG.md";
|
||||
description = "Delightfully simple discussion platform for your website";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue