mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #59381 from aanderse/automysqlbackup
automysqlinit: init at 3.0_rc6
This commit is contained in:
commit
c3f69d1373
6 changed files with 185 additions and 0 deletions
|
@ -23,6 +23,7 @@ in
|
|||
{
|
||||
acme = handleTestOn ["x86_64-linux"] ./acme.nix {};
|
||||
atd = handleTest ./atd.nix {};
|
||||
automysqlbackup = handleTest ./automysqlbackup.nix {};
|
||||
avahi = handleTest ./avahi.nix {};
|
||||
bcachefs = handleTestOn ["x86_64-linux"] ./bcachefs.nix {}; # linux-4.18.2018.10.12 is unsupported on aarch64
|
||||
beanstalkd = handleTest ./beanstalkd.nix {};
|
||||
|
|
34
nixos/tests/automysqlbackup.nix
Normal file
34
nixos/tests/automysqlbackup.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
import ./make-test.nix ({ pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
name = "automysqlbackup";
|
||||
meta.maintainers = [ lib.maintainers.aanderse ];
|
||||
|
||||
machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.mysql.enable = true;
|
||||
services.mysql.package = pkgs.mysql;
|
||||
services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
|
||||
|
||||
services.automysqlbackup.enable = true;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
|
||||
# Need to have mysql started so that it can be populated with data.
|
||||
$machine->waitForUnit("mysql.service");
|
||||
|
||||
# Wait for testdb to be fully populated (5 rows).
|
||||
$machine->waitUntilSucceeds("mysql -u root -D testdb -N -B -e 'select count(id) from tests' | grep -q 5");
|
||||
|
||||
# Do a backup and wait for it to start
|
||||
$machine->startJob("automysqlbackup.service");
|
||||
$machine->waitForJob("automysqlbackup.service");
|
||||
|
||||
# wait for backup file and check that data appears in backup
|
||||
$machine->waitForFile("/var/backup/mysql/daily/testdb");
|
||||
$machine->succeed("${pkgs.gzip}/bin/zcat /var/backup/mysql/daily/testdb/daily_testdb_*.sql.gz | grep hello");
|
||||
'';
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue