You can now run a test in the nixos/tests directory directly using nix-build, e.g. $ nix-build '<nixos/tests/login.nix>' -A test This gets rid of having to add the test to nixos/tests/default.nix. (Of course, you still need to add it to nixos/release.nix if you want Hydra to run the test.)
		
			
				
	
	
		
			23 lines
		
	
	
		
			556 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			556 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
import ./make-test.nix {
 | 
						|
 | 
						|
  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");
 | 
						|
  '';
 | 
						|
}
 |