lol

nixosTests.sourcehut: split tests belonging to different services

+61 -19
+1 -1
nixos/tests/all-tests.nix
··· 768 768 solanum = handleTest ./solanum.nix {}; 769 769 sonarr = handleTest ./sonarr.nix {}; 770 770 sonic-server = handleTest ./sonic-server.nix {}; 771 - sourcehut = handleTest ./sourcehut/sourcehut.nix {}; 771 + sourcehut = handleTest ./sourcehut {}; 772 772 spacecookie = handleTest ./spacecookie.nix {}; 773 773 spark = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./spark {}; 774 774 sqlite3-to-mysql = handleTest ./sqlite3-to-mysql.nix {};
+54
nixos/tests/sourcehut/builds.nix
··· 1 + import ../make-test-python.nix ({ pkgs, lib, ... }: 2 + let 3 + domain = "sourcehut.localdomain"; 4 + in 5 + { 6 + name = "sourcehut"; 7 + 8 + meta.maintainers = with pkgs.lib.maintainers; [ tomberek nessdoor ]; 9 + 10 + nodes.machine = { config, pkgs, nodes, ... }: { 11 + imports = [ 12 + ./nodes/common.nix 13 + ]; 14 + 15 + networking.domain = domain; 16 + networking.extraHosts = '' 17 + ${config.networking.primaryIPAddress} builds.${domain} 18 + ${config.networking.primaryIPAddress} meta.${domain} 19 + ''; 20 + 21 + services.sourcehut = { 22 + builds = { 23 + enable = true; 24 + # FIXME: see why it does not seem to activate fully. 25 + #enableWorker = true; 26 + images = { }; 27 + }; 28 + 29 + settings."builds.sr.ht" = { 30 + oauth-client-secret = pkgs.writeText "buildsrht-oauth-client-secret" "2260e9c4d9b8dcedcef642860e0504bc"; 31 + oauth-client-id = "299db9f9c2013170"; 32 + }; 33 + }; 34 + }; 35 + 36 + testScript = '' 37 + start_all() 38 + machine.wait_for_unit("multi-user.target") 39 + 40 + with subtest("Check whether meta comes up"): 41 + machine.wait_for_unit("metasrht-api.service") 42 + machine.wait_for_unit("metasrht.service") 43 + machine.wait_for_unit("metasrht-webhooks.service") 44 + machine.wait_for_open_port(5000) 45 + machine.succeed("curl -sL http://localhost:5000 | grep meta.${domain}") 46 + machine.succeed("curl -sL http://meta.${domain} | grep meta.${domain}") 47 + 48 + with subtest("Check whether builds comes up"): 49 + machine.wait_for_unit("buildsrht.service") 50 + machine.wait_for_open_port(5002) 51 + machine.succeed("curl -sL http://localhost:5002 | grep builds.${domain}") 52 + #machine.wait_for_unit("buildsrht-worker.service") 53 + ''; 54 + })
+6
nixos/tests/sourcehut/default.nix
··· 1 + { system, pkgs, ... }: 2 + 3 + { 4 + git = import ./git.nix { inherit system pkgs; }; 5 + builds = import ./builds.nix { inherit system pkgs; }; 6 + }
-18
nixos/tests/sourcehut/sourcehut.nix nixos/tests/sourcehut/git.nix
··· 14 14 15 15 networking.domain = domain; 16 16 networking.extraHosts = '' 17 - ${config.networking.primaryIPAddress} builds.${domain} 18 17 ${config.networking.primaryIPAddress} git.${domain} 19 18 ${config.networking.primaryIPAddress} meta.${domain} 20 19 ''; 21 20 22 21 services.sourcehut = { 23 - builds = { 24 - enable = true; 25 - # FIXME: see why it does not seem to activate fully. 26 - #enableWorker = true; 27 - images = { }; 28 - }; 29 22 git.enable = true; 30 - 31 - settings."builds.sr.ht" = { 32 - oauth-client-secret = pkgs.writeText "buildsrht-oauth-client-secret" "2260e9c4d9b8dcedcef642860e0504bc"; 33 - oauth-client-id = "299db9f9c2013170"; 34 - }; 35 23 settings."git.sr.ht" = { 36 24 oauth-client-secret = pkgs.writeText "gitsrht-oauth-client-secret" "3597288dc2c716e567db5384f493b09d"; 37 25 oauth-client-id = "d07cb713d920702e"; ··· 106 94 with subtest("Verify that the repo is downloadable and its contents match the original"): 107 95 machine.succeed("curl https://git.${domain}/~${userName}/test/archive/v0.1.tar.gz | tar -xz") 108 96 machine.succeed("diff test-v0.1/hello.txt test/hello.txt") 109 - 110 - with subtest("Check whether builds comes up"): 111 - machine.wait_for_unit("buildsrht.service") 112 - machine.wait_for_open_port(5002) 113 - machine.succeed("curl -sL http://localhost:5002 | grep builds.${domain}") 114 - #machine.wait_for_unit("buildsrht-worker.service") 115 97 ''; 116 98 })