tests/ferretdb: init
This commit is contained in:
parent
c54ab7d643
commit
8cff7c9e69
3 changed files with 68 additions and 0 deletions
|
@ -274,6 +274,7 @@ in {
|
||||||
fcitx5 = handleTest ./fcitx5 {};
|
fcitx5 = handleTest ./fcitx5 {};
|
||||||
fenics = handleTest ./fenics.nix {};
|
fenics = handleTest ./fenics.nix {};
|
||||||
ferm = handleTest ./ferm.nix {};
|
ferm = handleTest ./ferm.nix {};
|
||||||
|
ferretdb = handleTest ./ferretdb.nix {};
|
||||||
firefox = handleTest ./firefox.nix { firefoxPackage = pkgs.firefox; };
|
firefox = handleTest ./firefox.nix { firefoxPackage = pkgs.firefox; };
|
||||||
firefox-beta = handleTest ./firefox.nix { firefoxPackage = pkgs.firefox-beta; };
|
firefox-beta = handleTest ./firefox.nix { firefoxPackage = pkgs.firefox-beta; };
|
||||||
firefox-devedition = handleTest ./firefox.nix { firefoxPackage = pkgs.firefox-devedition; };
|
firefox-devedition = handleTest ./firefox.nix { firefoxPackage = pkgs.firefox-devedition; };
|
||||||
|
|
64
nixos/tests/ferretdb.nix
Normal file
64
nixos/tests/ferretdb.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{ system ? builtins.currentSystem
|
||||||
|
, pkgs ? import ../.. { inherit system; }
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
lib = pkgs.lib;
|
||||||
|
testScript = ''
|
||||||
|
machine.start()
|
||||||
|
machine.wait_for_unit("ferretdb.service")
|
||||||
|
machine.wait_for_open_port(27017)
|
||||||
|
machine.succeed("mongosh --eval 'use myNewDatabase;' --eval 'db.myCollection.insertOne( { x: 1 } );'")
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
with import ../lib/testing-python.nix { inherit system; };
|
||||||
|
{
|
||||||
|
|
||||||
|
postgresql = makeTest
|
||||||
|
{
|
||||||
|
inherit testScript;
|
||||||
|
name = "ferretdb-postgresql";
|
||||||
|
meta.maintainers = with lib.maintainers; [ julienmalka ];
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.ferretdb = {
|
||||||
|
enable = true;
|
||||||
|
settings.FERRETDB_HANDLER = "pg";
|
||||||
|
settings.FERRETDB_POSTGRESQL_URL = "postgres://ferretdb@localhost/ferretdb?host=/run/postgresql";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.ferretdb.serviceConfig = {
|
||||||
|
Requires = "postgresql.service";
|
||||||
|
After = "postgresql.service";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
ensureDatabases = [ "ferretdb" ];
|
||||||
|
ensureUsers = [{
|
||||||
|
name = "ferretdb";
|
||||||
|
ensurePermissions."DATABASE ferretdb" = "ALL PRIVILEGES";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [ mongosh ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sqlite = makeTest
|
||||||
|
{
|
||||||
|
inherit testScript;
|
||||||
|
name = "ferretdb-sqlite";
|
||||||
|
meta.maintainers = with lib.maintainers; [ julienmalka ];
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.ferretdb.enable = true;
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [ mongosh ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
{ lib
|
{ lib
|
||||||
, buildGo121Module
|
, buildGo121Module
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildGo121Module rec {
|
buildGo121Module rec {
|
||||||
|
@ -34,6 +35,8 @@ buildGo121Module rec {
|
||||||
$out/bin/ferretdb --version | grep ${version}
|
$out/bin/ferretdb --version | grep ${version}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests = nixosTests.ferretdb;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A truly Open Source MongoDB alternative";
|
description = "A truly Open Source MongoDB alternative";
|
||||||
homepage = "https://www.ferretdb.io/";
|
homepage = "https://www.ferretdb.io/";
|
||||||
|
|
Loading…
Reference in a new issue