aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/networking/croc/test-local-relay.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/tools/networking/croc/test-local-relay.nix')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/tools/networking/croc/test-local-relay.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/tools/networking/croc/test-local-relay.nix b/infra/libkookie/nixpkgs/pkgs/tools/networking/croc/test-local-relay.nix
new file mode 100644
index 000000000000..bde05d6deb0a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/tools/networking/croc/test-local-relay.nix
@@ -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
+ '';
+}