mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-31 14:41:27 +00:00
nixos/tests: add magic-wormhole-mailbox-server
This commit is contained in:
parent
05195040c0
commit
af75bb17b9
@ -170,6 +170,7 @@ in
|
||||
#logstash = handleTest ./logstash.nix {};
|
||||
lorri = handleTest ./lorri/default.nix {};
|
||||
magnetico = handleTest ./magnetico.nix {};
|
||||
magic-wormhole-mailbox-server = handleTest ./magic-wormhole-mailbox-server.nix {};
|
||||
mailcatcher = handleTest ./mailcatcher.nix {};
|
||||
mathics = handleTest ./mathics.nix {};
|
||||
matomo = handleTest ./matomo.nix {};
|
||||
|
38
nixos/tests/magic-wormhole-mailbox-server.nix
Normal file
38
nixos/tests/magic-wormhole-mailbox-server.nix
Normal file
@ -0,0 +1,38 @@
|
||||
import ./make-test-python.nix ({ pkgs, ... }: {
|
||||
name = "magic-wormhole-mailbox-server";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ mmahut ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
server = { ... }: {
|
||||
networking.firewall.allowedTCPPorts = [ 4000 ];
|
||||
services.magic-wormhole-mailbox-server.enable = true;
|
||||
};
|
||||
|
||||
client_alice = { ... }: {
|
||||
networking.firewall.enable = false;
|
||||
environment.systemPackages = [ pkgs.magic-wormhole ];
|
||||
};
|
||||
|
||||
client_bob = { ... }: {
|
||||
environment.systemPackages = [ pkgs.magic-wormhole ];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
# Start the wormhole relay server
|
||||
server.wait_for_unit("magic-wormhole-mailbox-server.service")
|
||||
server.wait_for_open_port(4000)
|
||||
|
||||
# Create a secret file and send it to Bob
|
||||
client_alice.succeed("echo mysecret > secretfile")
|
||||
client_alice.succeed("wormhole --relay-url=ws://server:4000/v1 send -0 secretfile &")
|
||||
|
||||
# Retrieve a secret file from Alice and check its content
|
||||
client_bob.succeed("wormhole --relay-url=ws://server:4000/v1 receive -0 --accept-file")
|
||||
client_bob.succeed("grep mysecret secretfile")
|
||||
'';
|
||||
})
|
Loading…
Reference in New Issue
Block a user