mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
80 lines
2.2 KiB
Nix
80 lines
2.2 KiB
Nix
{
|
|
system ? builtins.currentSystem,
|
|
config ? { },
|
|
pkgs ? import ../../.. { inherit system config; },
|
|
lib ? pkgs.lib,
|
|
}:
|
|
|
|
let
|
|
inherit (import ./common.nix { inherit pkgs lib; }) mkTestName mariadbPackages;
|
|
|
|
makeTest = import ./../make-test-python.nix;
|
|
|
|
makeBackupTest =
|
|
{
|
|
package,
|
|
name ? mkTestName package,
|
|
}:
|
|
makeTest {
|
|
name = "${name}-backup";
|
|
|
|
nodes = {
|
|
master =
|
|
{ pkgs, ... }:
|
|
{
|
|
services.mysql = {
|
|
inherit package;
|
|
enable = true;
|
|
initialDatabases = [
|
|
{
|
|
name = "testdb";
|
|
schema = ./testdb.sql;
|
|
}
|
|
];
|
|
};
|
|
|
|
services.mysqlBackup = {
|
|
enable = true;
|
|
databases = [
|
|
"doesnotexist"
|
|
"testdb"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
# Delete backup file that may be left over from a previous test run.
|
|
# This is not needed on Hydra but useful for repeated local test runs.
|
|
master.execute("rm -f /var/backup/mysql/testdb.gz")
|
|
|
|
# Need to have mysql started so that it can be populated with data.
|
|
master.wait_for_unit("mysql.service")
|
|
|
|
# Wait for testdb to be fully populated (5 rows).
|
|
master.wait_until_succeeds(
|
|
"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
|
|
master.start_job("mysql-backup.service")
|
|
|
|
# wait for backup to fail, because of database 'doesnotexist'
|
|
master.wait_until_fails("systemctl is-active -q mysql-backup.service")
|
|
|
|
# wait for backup file and check that data appears in backup
|
|
master.wait_for_file("/var/backup/mysql/testdb.gz")
|
|
master.succeed(
|
|
"${pkgs.gzip}/bin/zcat /var/backup/mysql/testdb.gz | grep hello"
|
|
)
|
|
|
|
# Check that a failed backup is logged
|
|
master.succeed(
|
|
"journalctl -u mysql-backup.service | grep 'fail.*doesnotexist' > /dev/null"
|
|
)
|
|
'';
|
|
};
|
|
in
|
|
lib.mapAttrs (_: package: makeBackupTest { inherit package; }) mariadbPackages
|