mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
unit: add nixos tests for perl
This commit is contained in:
parent
762d2c1971
commit
67ecdcbb97
3 changed files with 51 additions and 1 deletions
|
@ -1055,6 +1055,7 @@ in {
|
||||||
unbound = handleTest ./unbound.nix {};
|
unbound = handleTest ./unbound.nix {};
|
||||||
unifi = handleTest ./unifi.nix {};
|
unifi = handleTest ./unifi.nix {};
|
||||||
unit-php = handleTest ./web-servers/unit-php.nix {};
|
unit-php = handleTest ./web-servers/unit-php.nix {};
|
||||||
|
unit-perl = handleTest ./web-servers/unit-perl.nix {};
|
||||||
upnp.iptables = handleTest ./upnp.nix { useNftables = false; };
|
upnp.iptables = handleTest ./upnp.nix { useNftables = false; };
|
||||||
upnp.nftables = handleTest ./upnp.nix { useNftables = true; };
|
upnp.nftables = handleTest ./upnp.nix { useNftables = true; };
|
||||||
uptermd = handleTest ./uptermd.nix {};
|
uptermd = handleTest ./uptermd.nix {};
|
||||||
|
|
46
nixos/tests/web-servers/unit-perl.nix
Normal file
46
nixos/tests/web-servers/unit-perl.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import ../make-test-python.nix (
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
testdir = pkgs.writeTextDir "www/app.psgi" ''
|
||||||
|
my $app = sub {
|
||||||
|
return [
|
||||||
|
"200",
|
||||||
|
[ "Content-Type" => "text/plain" ],
|
||||||
|
[ "Hello, Perl on Unit!" ],
|
||||||
|
];
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "unit-perl-test";
|
||||||
|
meta.maintainers = with pkgs.lib.maintainers; [ sgo ];
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
services.unit = {
|
||||||
|
enable = true;
|
||||||
|
config = pkgs.lib.strings.toJSON {
|
||||||
|
listeners."*:8080".application = "perl";
|
||||||
|
applications.perl = {
|
||||||
|
type = "perl";
|
||||||
|
script = "${testdir}/www/app.psgi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("unit.service")
|
||||||
|
machine.wait_for_open_port(8080)
|
||||||
|
|
||||||
|
response = machine.succeed("curl -f -vvv -s http://127.0.0.1:8080/")
|
||||||
|
assert "Hello, Perl on Unit!" in response, "Hello world"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
)
|
|
@ -68,7 +68,10 @@ in stdenv.mkDerivation rec {
|
||||||
${optionalString withRuby_3_2 "./configure ruby --module=ruby32 --ruby=${ruby_3_2}/bin/ruby"}
|
${optionalString withRuby_3_2 "./configure ruby --module=ruby32 --ruby=${ruby_3_2}/bin/ruby"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.tests.unit-php = nixosTests.unit-php;
|
passthru.tests = {
|
||||||
|
unit-perl = nixosTests.unit-perl;
|
||||||
|
unit-php = nixosTests.unit-php;
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Dynamic web and application server, designed to run applications in multiple languages";
|
description = "Dynamic web and application server, designed to run applications in multiple languages";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue