at 23.05-pre 2.5 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: 2 3let 4 port = 3142; 5 username = "alice"; 6 password = "correcthorsebatterystaple"; 7 defaultPort = 8080; 8 defaultUsername = "admin"; 9 defaultPassword = "password"; 10 adminCredentialsFile = pkgs.writeText "admin-credentials" '' 11 ADMIN_USERNAME=${defaultUsername} 12 ADMIN_PASSWORD=${defaultPassword} 13 ''; 14 customAdminCredentialsFile = pkgs.writeText "admin-credentials" '' 15 ADMIN_USERNAME=${username} 16 ADMIN_PASSWORD=${password} 17 ''; 18 19in 20with lib; 21{ 22 name = "miniflux"; 23 meta.maintainers = with pkgs.lib.maintainers; [ ]; 24 25 nodes = { 26 default = 27 { ... }: 28 { 29 services.miniflux = { 30 enable = true; 31 inherit adminCredentialsFile; 32 }; 33 }; 34 35 withoutSudo = 36 { ... }: 37 { 38 services.miniflux = { 39 enable = true; 40 inherit adminCredentialsFile; 41 }; 42 security.sudo.enable = false; 43 }; 44 45 customized = 46 { ... }: 47 { 48 services.miniflux = { 49 enable = true; 50 config = { 51 CLEANUP_FREQUENCY = "48"; 52 LISTEN_ADDR = "localhost:${toString port}"; 53 }; 54 adminCredentialsFile = customAdminCredentialsFile; 55 }; 56 }; 57 }; 58 testScript = '' 59 start_all() 60 61 default.wait_for_unit("miniflux.service") 62 default.wait_for_open_port(${toString defaultPort}) 63 default.succeed("curl --fail 'http://localhost:${toString defaultPort}/healthcheck' | grep OK") 64 default.succeed( 65 "curl 'http://localhost:${toString defaultPort}/v1/me' -u '${defaultUsername}:${defaultPassword}' -H Content-Type:application/json | grep '\"is_admin\":true'" 66 ) 67 68 withoutSudo.wait_for_unit("miniflux.service") 69 withoutSudo.wait_for_open_port(${toString defaultPort}) 70 withoutSudo.succeed("curl --fail 'http://localhost:${toString defaultPort}/healthcheck' | grep OK") 71 withoutSudo.succeed( 72 "curl 'http://localhost:${toString defaultPort}/v1/me' -u '${defaultUsername}:${defaultPassword}' -H Content-Type:application/json | grep '\"is_admin\":true'" 73 ) 74 75 customized.wait_for_unit("miniflux.service") 76 customized.wait_for_open_port(${toString port}) 77 customized.succeed("curl --fail 'http://localhost:${toString port}/healthcheck' | grep OK") 78 customized.succeed( 79 "curl 'http://localhost:${toString port}/v1/me' -u '${username}:${password}' -H Content-Type:application/json | grep '\"is_admin\":true'" 80 ) 81 ''; 82})