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


                                            
 
           
            
                            
 

                                     

                                                                                          
                                            
        
    
 

                 
 
                                  
                                                         
                                                                                           
     
  
import ./make-test.nix ({ pkgs, ...} : {
  name = "mysql";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ eelco chaoflow shlevy ];
  };

  nodes = {
    master =
      { pkgs, config, ... }:

      {
        services.mysql.enable = true;
        services.mysql.replication.role = "master";
        services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
        services.mysql.package = pkgs.mysql;
      };
  };

  testScript = ''
    startAll;

    $master->waitForUnit("mysql");
    $master->sleep(10); # Hopefully this is long enough!!
    $master->succeed("echo 'use testdb; select * from tests' | mysql -u root -N | grep 4");
  '';
})