Unverified Commit cea1cbed authored by Maximilian Bosch's avatar Maximilian Bosch Committed by GitHub
Browse files

postgresql: use structuredAttrs instead of passAsFile in tests (#515386)

parents acd02b87 8271ddc8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ stdenv.mkDerivation {
  nativeCheckInputs = [ postgresql ];
  dontUnpack = true;
  doCheck = true;
  passAsFile = [ "sql" ];
  sql = ''
    CREATE TABLE hello (
      message text
@@ -23,6 +22,8 @@ stdenv.mkDerivation {
  '';
  checkPhase = ''
    runHook preCheck
    sqlPath=$TMPDIR/test.sql
    printf "%s" "$sql" > $sqlPath
    psql <$sqlPath | grep 'it worked'
    TEST_RAN=1
    runHook postCheck
@@ -31,4 +32,5 @@ stdenv.mkDerivation {
    [[ $TEST_RAN == 1 && $TEST_POST_HOOK_RAN == 1 ]]
    touch $out
  '';
  __structuredAttrs = true;
}
+3 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ postgresqlBuildExtension (finalAttrs: {
      postgresqlTestHook
      (postgresql.withPackages (_: [ finalAttrs.finalPackage ]))
    ];
    passAsFile = [ "sql" ];
    sql = ''
      CREATE EXTENSION pgtap;

@@ -47,10 +46,13 @@ postgresqlBuildExtension (finalAttrs: {
    '';
    checkPhase = ''
      runHook preCheck
      sqlPath=$TMPDIR/test.sql
      printf "%s" "$sql" > $sqlPath
      psql -a -v ON_ERROR_STOP=1 -f $sqlPath
      runHook postCheck
    '';
    installPhase = "touch $out";
    __structuredAttrs = true;
  };

  meta = {
+3 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ stdenvNoCC.mkDerivation (
      (postgresql.withPackages (ps: [ finalPackage ] ++ (map (p: ps."${p}") withPackages)))
    ];
    postgresqlTestUserOptions = "LOGIN SUPERUSER";
    passAsFile = [ "sql" ];
    sql =
      sql
      + lib.concatMapStrings (
@@ -39,10 +38,13 @@ stdenvNoCC.mkDerivation (
      ) asserts;
    checkPhase = ''
      runHook preCheck
      sqlPath=$TMPDIR/test.sql
      printf "%s" "$sql" > $sqlPath
      psql -a -v ON_ERROR_STOP=1 -f "$sqlPath"
      runHook postCheck
    '';
    installPhase = "touch $out";
    __structuredAttrs = true;
  }
  // lib.removeAttrs extraArgs [
    "asserts"