mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
nixos/aria2: add test
This commit is contained in:
parent
31c9eec061
commit
1389666a11
@ -129,6 +129,7 @@ in {
|
||||
appliance-repart-image = runTest ./appliance-repart-image.nix;
|
||||
apparmor = handleTest ./apparmor.nix {};
|
||||
archi = handleTest ./archi.nix {};
|
||||
aria2 = handleTest ./aria2.nix {};
|
||||
armagetronad = handleTest ./armagetronad.nix {};
|
||||
atd = handleTest ./atd.nix {};
|
||||
atop = handleTest ./atop.nix {};
|
||||
|
43
nixos/tests/aria2.nix
Normal file
43
nixos/tests/aria2.nix
Normal file
@ -0,0 +1,43 @@
|
||||
import ./make-test-python.nix ({ pkgs, ... }:
|
||||
let
|
||||
rpcSecret = "supersecret";
|
||||
rpc-listen-port = 6800;
|
||||
curlBody = {
|
||||
jsonrpc = 2.0;
|
||||
id = 1;
|
||||
method = "aria2.getVersion";
|
||||
params = [ "token:${rpcSecret}" ];
|
||||
};
|
||||
in
|
||||
rec {
|
||||
name = "aria2";
|
||||
|
||||
nodes.machine = {
|
||||
environment.etc."aria2Rpc".text = rpcSecret;
|
||||
services.aria2 = {
|
||||
enable = true;
|
||||
rpcSecretFile = "/etc/aria2Rpc";
|
||||
settings = {
|
||||
inherit rpc-listen-port;
|
||||
allow-overwrite = false;
|
||||
check-integrity = true;
|
||||
console-log-level = "warn";
|
||||
listen-port = [{ from = 20000; to = 20010; } { from = 22222; to = 22222; }];
|
||||
max-concurrent-downloads = 50;
|
||||
seed-ratio = 1.2;
|
||||
summary-interval = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.start()
|
||||
machine.wait_for_unit("aria2.service")
|
||||
curl_cmd = 'curl --fail-with-body -X POST -H "Content-Type: application/json" \
|
||||
-d \'${builtins.toJSON curlBody}\' http://localhost:${toString rpc-listen-port}/jsonrpc'
|
||||
print(machine.wait_until_succeeds(curl_cmd, timeout=10))
|
||||
machine.shutdown()
|
||||
'';
|
||||
|
||||
meta.maintainers = [ pkgs.lib.maintainers.timhae ];
|
||||
})
|
@ -1,7 +1,7 @@
|
||||
{ lib, stdenv, fetchFromGitHub, fetchpatch, pkg-config, autoreconfHook
|
||||
, gnutls, c-ares, libxml2, sqlite, zlib, libssh2
|
||||
, cppunit, sphinx
|
||||
, Security
|
||||
, Security, nixosTests
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -38,6 +38,10 @@ stdenv.mkDerivation rec {
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru.tests = {
|
||||
aria2 = nixosTests.aria2;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://aria2.github.io";
|
||||
description = "A lightweight, multi-protocol, multi-source, command-line download utility";
|
||||
|
Loading…
Reference in New Issue
Block a user