summary refs log blame commit diff
path: root/nixos/tests/gitea.nix
blob: b8ab6dabc8c1f20678fa04608c25c6b7a9c9b568 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11



                                                
 
                                                        




                         
                                                               


                            
                                     
                                               
















                                                              
                                     
                                                  

















                                                              
                                                  







                                                              
                                                                                                                                                     


       
{ system ? builtins.currentSystem,
  config ? {},
  pkgs ? import ../.. { inherit system config; }
}:

with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;

{
  mysql = makeTest {
    name = "gitea-mysql";
    meta.maintainers = with maintainers; [ aanderse kolaente ];

    machine =
      { config, pkgs, ... }:
      { services.gitea.enable = true;
        services.gitea.database.type = "mysql";
      };

    testScript = ''
      startAll;

      $machine->waitForUnit('gitea.service');
      $machine->waitForOpenPort('3000');
      $machine->succeed("curl --fail http://localhost:3000/");
    '';
  };

  postgres = makeTest {
    name = "gitea-postgres";
    meta.maintainers = [ maintainers.aanderse ];

    machine =
      { config, pkgs, ... }:
      { services.gitea.enable = true;
        services.gitea.database.type = "postgres";
      };

    testScript = ''
      startAll;

      $machine->waitForUnit('gitea.service');
      $machine->waitForOpenPort('3000');
      $machine->succeed("curl --fail http://localhost:3000/");
    '';
  };

  sqlite = makeTest {
    name = "gitea-sqlite";
    meta.maintainers = [ maintainers.aanderse ];

    machine =
      { config, pkgs, ... }:
      { services.gitea.enable = true;
        services.gitea.disableRegistration = true;
      };

    testScript = ''
      startAll;

      $machine->waitForUnit('gitea.service');
      $machine->waitForOpenPort('3000');
      $machine->succeed("curl --fail http://localhost:3000/");
      $machine->succeed("curl --fail http://localhost:3000/user/sign_up | grep 'Registration is disabled. Please contact your site administrator.'");
    '';
  };
}