2 system ? builtins.currentSystem,
4 pkgs ? import ../../.. { inherit system config; },
9 inherit (import ./common.nix { inherit pkgs lib; }) mkTestName mariadbPackages;
11 makeTest = import ./../make-test-python.nix;
16 name ? mkTestName package,
19 name = "${name}-automysqlbackup";
20 meta.maintainers = [ lib.maintainers.aanderse ];
29 schema = ./testdb.sql;
34 services.automysqlbackup.enable = true;
35 automysqlbackup.settings.mysql_dump_port = "";
41 # Need to have mysql started so that it can be populated with data.
42 machine.wait_for_unit("mysql.service")
44 with subtest("Wait for testdb to be fully populated (5 rows)."):
45 machine.wait_until_succeeds(
46 "mysql -u root -D testdb -N -B -e 'select count(id) from tests' | grep -q 5"
49 with subtest("Do a backup and wait for it to start"):
50 machine.start_job("automysqlbackup.service")
51 machine.wait_for_job("automysqlbackup.service")
53 with subtest("wait for backup file and check that data appears in backup"):
54 machine.wait_for_file("/var/backup/mysql/daily/testdb")
56 "${pkgs.gzip}/bin/zcat /var/backup/mysql/daily/testdb/daily_testdb_*.sql.gz | grep hello"
61 lib.mapAttrs (_: package: makeAutobackupTest { inherit package; }) mariadbPackages