New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests/postgresql-wal-receiver: Port to Python #96349
tests/postgresql-wal-receiver: Port to Python #96349
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
restore_command = 'cp ${walBackupDir}/%f %p' | ||
''; | ||
pkg = pkgs."${postgresqlPackage}"; | ||
postgresqlDataDir = "/var/db/postgresql/${lib.versions.major pkg.version}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you forget removing this?
systemd.tmpfiles.rules = [ | ||
"d /var/db/postgresql 0700 postgres postgres" | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you forget removing this?
services.postgresql = { | ||
package = pkg; | ||
enable = true; | ||
dataDir = postgresqlDataDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you forget removing this?
# stop postgres and destroy data | ||
machine.systemctl("stop postgresql") | ||
machine.systemctl("stop postgresql-wal-receiver-main") | ||
machine.succeed("rm -r ${postgresqlDataDir}/{base,global,pg_*}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be updated.
"for part in ${walBackupDir}/*.partial; do mv $part ''${part%%.*}; done" | ||
) # make use of partial segments too | ||
machine.succeed( | ||
"cp ${recoveryFile}/* ${postgresqlDataDir}/ && chmod 666 ${postgresqlDataDir}/recovery*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be updated.
$machine->succeed('cp -r ${baseBackupDir}/* ${postgresqlDataDir} && chown postgres:postgres -R ${postgresqlDataDir}'); | ||
# restore the base backup | ||
machine.succeed( | ||
"cp -r ${baseBackupDir}/* ${postgresqlDataDir} && chown postgres:postgres -R ${postgresqlDataDir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be updated.
$machine->waitForUnit('postgresql'); | ||
# replay WAL | ||
machine.systemctl("start postgresql") | ||
machine.wait_for_file("${postgresqlDataDir}/recovery.done") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be updated.
... and remove some weirdnesses. - Port to Python - Drop the extra pkgs, config, system args - Drop all `with` - Don't override the standard PostgreSQL directory - Use pkgs and lib from the test runner Tested with: - postgresql_12 - postgresql_11 - postgresql_10 - postgresql_9_6 - postgresql_9_5 Closes NixOS#96347 cc @flokli
29d5125
to
ead6de5
Compare
... and remove some weirdnesses.
with
Tested with:
Closes #96347
cc @flokli
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)