croc: add passthru.tests
This commit is contained in:
parent
50277ebdd2
commit
166a0642d4
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, buildGoModule, fetchFromGitHub }:
|
||||
{ stdenv, buildGoModule, fetchFromGitHub, callPackage}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "croc";
|
||||
|
@ -17,6 +17,11 @@ buildGoModule rec {
|
|||
|
||||
subPackages = [ "." ];
|
||||
|
||||
passthru = {
|
||||
tests = {
|
||||
local-relay = callPackage ./test-local-relay.nix {};
|
||||
};
|
||||
};
|
||||
meta = with stdenv.lib; {
|
||||
description =
|
||||
"Easily and securely send things from one computer to another";
|
||||
|
|
20
pkgs/tools/networking/croc/test-local-relay.nix
Normal file
20
pkgs/tools/networking/croc/test-local-relay.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ stdenv, croc }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "croc-test-local-relay";
|
||||
meta.timeout = 300;
|
||||
buildCommand = ''
|
||||
HOME=$(mktemp -d)
|
||||
# start a local relay
|
||||
${croc}/bin/croc relay --ports 11111,11112 &
|
||||
# start sender in background
|
||||
MSG="See you later, alligator!"
|
||||
${croc}/bin/croc --relay localhost:11111 send --code correct-horse-battery-staple --text "$MSG" &
|
||||
# wait for things to settle
|
||||
sleep 1
|
||||
# receive
|
||||
MSG2=$(${croc}/bin/croc --relay localhost:11111 --yes correct-horse-battery-staple)
|
||||
# compare
|
||||
[ "$MSG" = "$MSG2" ] && touch $out
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue