anchor.diff:  with pkgs.lib;
   
   let
  +  makePostgresqlWalReceiverTest = subTestName: postgresqlPackage: let
  +
     postgresqlDataDir = "/var/db/postgresql/test";
     replicationUser = "wal_receiver_user";
     replicationSlot = "wal_receiver_slot";
     replicationConn = "postgresql://${replicationUser}@localhost";
     baseBackupDir = "/tmp/pg_basebackup";
     walBackupDir = "/tmp/pg_wal";
  -  recoveryConf = pkgs.writeText "recovery.conf" ''
  +  atLeast12 = versionAtLeast postgresqlPackage.version "12.0";
  +  restoreCommand = ''
       restore_command = 'cp ${walBackupDir}/%f %p'
     '';
   
  -  makePostgresqlWalReceiverTest = subTestName: postgresqlPackage: makeTest {
  +  recoveryFile = if atLeast12
  +      then pkgs.writeTextDir "recovery.signal" ""
  +      else pkgs.writeTextDir "recovery.conf" "${restoreCommand}";
  +
  +  in makeTest {
       name = "postgresql-wal-receiver-${subTestName}";
       meta.maintainers = with maintainers; [ pacien ];
   
  
positive.code:         slot = replicationSlot;
          directory = walBackupDir;
        };
      };
  
      testScript = ''
  
negative.code:       # prepare WAL and recovery
        $machine->succeed('chmod a+rX -R ${walBackupDir}');
        $machine->execute('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*');
  
        # replay WAL
        $machine->systemctl('start postgresql');
  