Loading nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ in { budgie = handleTest ./budgie.nix {}; buildbot = handleTest ./buildbot.nix {}; buildkite-agents = handleTest ./buildkite-agents.nix {}; c2fmzq = handleTest ./c2fmzq.nix {}; caddy = handleTest ./caddy.nix {}; cadvisor = handleTestOn ["x86_64-linux"] ./cadvisor.nix {}; cage = handleTest ./cage.nix {}; Loading nixos/tests/c2fmzq.nix 0 → 100644 +75 −0 Original line number Diff line number Diff line import ./make-test-python.nix ({ pkgs, lib, ... }: { name = "c2FmZQ"; meta.maintainers = with lib.maintainers; [ hmenke ]; nodes.machine = { services.c2fmzq-server = { enable = true; port = 8080; passphraseFile = builtins.toFile "pwfile" "hunter2"; # don't do this on real deployments settings = { verbose = 3; # debug }; }; environment = { sessionVariables = { C2FMZQ_PASSPHRASE = "lol"; C2FMZQ_API_SERVER = "http://localhost:8080"; }; systemPackages = [ pkgs.c2fmzq (pkgs.writeScriptBin "c2FmZQ-client-wrapper" '' #!${pkgs.expect}/bin/expect -f spawn c2FmZQ-client {*}$argv expect { "Enter password:" { send "$env(PASSWORD)\r" } "Type YES to confirm:" { send "YES\r" } timeout { exit 1 } eof { exit 0 } } interact '') ]; }; }; testScript = { nodes, ... }: '' machine.start() machine.wait_for_unit("c2fmzq-server.service") machine.wait_for_open_port(8080) with subtest("Create accounts for alice and bob"): machine.succeed("PASSWORD=foobar c2FmZQ-client-wrapper -- -v 3 create-account alice@example.com") machine.succeed("PASSWORD=fizzbuzz c2FmZQ-client-wrapper -- -v 3 create-account bob@example.com") with subtest("Log in as alice"): machine.succeed("PASSWORD=foobar c2FmZQ-client-wrapper -- -v 3 login alice@example.com") msg = machine.succeed("c2FmZQ-client -v 3 status") assert "Logged in as alice@example.com" in msg, f"ERROR: Not logged in as alice:\n{msg}" with subtest("Create a new album, upload a file, and delete the uploaded file"): machine.succeed("c2FmZQ-client -v 3 create-album 'Rarest Memes'") machine.succeed("echo 'pls do not steal' > meme.txt") machine.succeed("c2FmZQ-client -v 3 import meme.txt 'Rarest Memes'") machine.succeed("c2FmZQ-client -v 3 sync") machine.succeed("rm meme.txt") with subtest("Share the album with bob"): machine.succeed("c2FmZQ-client-wrapper -- -v 3 share 'Rarest Memes' bob@example.com") with subtest("Log in as bob"): machine.succeed("PASSWORD=fizzbuzz c2FmZQ-client-wrapper -- -v 3 login bob@example.com") msg = machine.succeed("c2FmZQ-client -v 3 status") assert "Logged in as bob@example.com" in msg, f"ERROR: Not logged in as bob:\n{msg}" with subtest("Download the shared file"): machine.succeed("c2FmZQ-client -v 3 download 'shared/Rarest Memes/meme.txt'") machine.succeed("c2FmZQ-client -v 3 export 'shared/Rarest Memes/meme.txt' .") msg = machine.succeed("cat meme.txt") assert "pls do not steal\n" == msg, f"File content is not the same:\n{msg}" with subtest("Test that PWA is served"): msg = machine.succeed("curl -sSfL http://localhost:8080") assert "c2FmZQ" in msg, f"Could not find 'c2FmZQ' in the output:\n{msg}" ''; }) pkgs/by-name/c2/c2fmzq/package.nix +3 −0 Original line number Diff line number Diff line { lib , buildGoModule , fetchFromGitHub , nixosTests }: buildGoModule rec { Loading @@ -22,6 +23,8 @@ buildGoModule rec { subPackages = [ "c2FmZQ-client" "c2FmZQ-server" ]; passthru.tests = { inherit (nixosTests) c2fmzq; }; meta = with lib; { description = "Securely encrypt, store, and share files, including but not limited to pictures and videos"; homepage = "https://github.com/c2FmZQ/c2FmZQ"; Loading Loading
nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ in { budgie = handleTest ./budgie.nix {}; buildbot = handleTest ./buildbot.nix {}; buildkite-agents = handleTest ./buildkite-agents.nix {}; c2fmzq = handleTest ./c2fmzq.nix {}; caddy = handleTest ./caddy.nix {}; cadvisor = handleTestOn ["x86_64-linux"] ./cadvisor.nix {}; cage = handleTest ./cage.nix {}; Loading
nixos/tests/c2fmzq.nix 0 → 100644 +75 −0 Original line number Diff line number Diff line import ./make-test-python.nix ({ pkgs, lib, ... }: { name = "c2FmZQ"; meta.maintainers = with lib.maintainers; [ hmenke ]; nodes.machine = { services.c2fmzq-server = { enable = true; port = 8080; passphraseFile = builtins.toFile "pwfile" "hunter2"; # don't do this on real deployments settings = { verbose = 3; # debug }; }; environment = { sessionVariables = { C2FMZQ_PASSPHRASE = "lol"; C2FMZQ_API_SERVER = "http://localhost:8080"; }; systemPackages = [ pkgs.c2fmzq (pkgs.writeScriptBin "c2FmZQ-client-wrapper" '' #!${pkgs.expect}/bin/expect -f spawn c2FmZQ-client {*}$argv expect { "Enter password:" { send "$env(PASSWORD)\r" } "Type YES to confirm:" { send "YES\r" } timeout { exit 1 } eof { exit 0 } } interact '') ]; }; }; testScript = { nodes, ... }: '' machine.start() machine.wait_for_unit("c2fmzq-server.service") machine.wait_for_open_port(8080) with subtest("Create accounts for alice and bob"): machine.succeed("PASSWORD=foobar c2FmZQ-client-wrapper -- -v 3 create-account alice@example.com") machine.succeed("PASSWORD=fizzbuzz c2FmZQ-client-wrapper -- -v 3 create-account bob@example.com") with subtest("Log in as alice"): machine.succeed("PASSWORD=foobar c2FmZQ-client-wrapper -- -v 3 login alice@example.com") msg = machine.succeed("c2FmZQ-client -v 3 status") assert "Logged in as alice@example.com" in msg, f"ERROR: Not logged in as alice:\n{msg}" with subtest("Create a new album, upload a file, and delete the uploaded file"): machine.succeed("c2FmZQ-client -v 3 create-album 'Rarest Memes'") machine.succeed("echo 'pls do not steal' > meme.txt") machine.succeed("c2FmZQ-client -v 3 import meme.txt 'Rarest Memes'") machine.succeed("c2FmZQ-client -v 3 sync") machine.succeed("rm meme.txt") with subtest("Share the album with bob"): machine.succeed("c2FmZQ-client-wrapper -- -v 3 share 'Rarest Memes' bob@example.com") with subtest("Log in as bob"): machine.succeed("PASSWORD=fizzbuzz c2FmZQ-client-wrapper -- -v 3 login bob@example.com") msg = machine.succeed("c2FmZQ-client -v 3 status") assert "Logged in as bob@example.com" in msg, f"ERROR: Not logged in as bob:\n{msg}" with subtest("Download the shared file"): machine.succeed("c2FmZQ-client -v 3 download 'shared/Rarest Memes/meme.txt'") machine.succeed("c2FmZQ-client -v 3 export 'shared/Rarest Memes/meme.txt' .") msg = machine.succeed("cat meme.txt") assert "pls do not steal\n" == msg, f"File content is not the same:\n{msg}" with subtest("Test that PWA is served"): msg = machine.succeed("curl -sSfL http://localhost:8080") assert "c2FmZQ" in msg, f"Could not find 'c2FmZQ' in the output:\n{msg}" ''; })
pkgs/by-name/c2/c2fmzq/package.nix +3 −0 Original line number Diff line number Diff line { lib , buildGoModule , fetchFromGitHub , nixosTests }: buildGoModule rec { Loading @@ -22,6 +23,8 @@ buildGoModule rec { subPackages = [ "c2FmZQ-client" "c2FmZQ-server" ]; passthru.tests = { inherit (nixosTests) c2fmzq; }; meta = with lib; { description = "Securely encrypt, store, and share files, including but not limited to pictures and videos"; homepage = "https://github.com/c2FmZQ/c2FmZQ"; Loading