nixos/firefox-syncserver: fix local database access, add a nixos test (#465453)
This commit is contained in:
@@ -13,7 +13,7 @@ let
|
||||
defaultUser = "firefox-syncserver";
|
||||
|
||||
dbIsLocal = cfg.database.host == "localhost";
|
||||
dbURL = "mysql://${cfg.database.user}@${cfg.database.host}/${cfg.database.name}";
|
||||
dbURL = "mysql://${cfg.database.user}@${cfg.database.host}/${cfg.database.name}${lib.optionalString dbIsLocal "?socket=/run/mysqld/mysqld.sock"}";
|
||||
|
||||
format = pkgs.formats.toml { };
|
||||
settings = {
|
||||
|
||||
@@ -569,6 +569,7 @@ in
|
||||
imports = [ ./firefox.nix ];
|
||||
_module.args.firefoxPackage = pkgs.firefox-esr-140;
|
||||
};
|
||||
firefox-syncserver = runTest ./firefox-syncserver.nix;
|
||||
firefoxpwa = runTest ./firefoxpwa.nix;
|
||||
firejail = runTest ./firejail.nix;
|
||||
firewall = runTest {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
name = "firefox-syncserver";
|
||||
nodes.machine = {
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = pkgs.mariadb;
|
||||
};
|
||||
|
||||
services.firefox-syncserver = {
|
||||
enable = true;
|
||||
secrets = pkgs.writeText "secret" "this-is-a-test";
|
||||
singleNode = {
|
||||
enable = true;
|
||||
hostname = "firefox-syncserver.local";
|
||||
capacity = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("firefox-syncserver.service")
|
||||
machine.wait_for_open_port(5000)
|
||||
|
||||
machine.wait_until_succeeds("curl --fail http://127.0.0.1:5000")
|
||||
|
||||
'';
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
makeBinaryWrapper,
|
||||
lib,
|
||||
nix-update-script,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -54,6 +55,8 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
passthru.tests = { inherit (nixosTests) firefox-syncserver; };
|
||||
|
||||
meta = {
|
||||
description = "Mozilla Sync Storage built with Rust";
|
||||
homepage = "https://github.com/mozilla-services/syncstorage-rs";
|
||||
|
||||
Reference in New Issue
Block a user