Search Postgresql Archives

Re: How can I include sql file in pgTAP unittest?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/02/2018 06:46 AM, Stéphane Klein wrote:



Sorry, it is not kea but db2 in my example. I did a mistake when I replace the db name in my example.

You need to read:

   CREATE EXTENSION IF NOT EXISTS postgres_fdw;
   DROP SERVER IF EXISTS db2 CASCADE;
  CREATE SERVER db2 FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'db2', dbname 'db2');   CREATE USER MAPPING FOR USER SERVER db2 OPTIONS (user 'db2', password 'password');

   CREATE SCHEMA IF NOT EXISTS db2;

   IMPORT FOREIGN SCHEMA public FROM SERVER db2 INTO db2;

I don't know much about pgTap, but my first instinct would be to change:

BEGIN;
  SELECT plan(1);

  \i /test/init.sql

  SELECT ok(
    (SELECT COUNT(host_id) FROM db2.hosts) = 1,
    'foobar'
  );

to:


BEGIN;

  \i /test/init.sql

  SELECT plan(1);

  SELECT ok(
    (SELECT COUNT(host_id) FROM db2.hosts) = 1,
    'foobar'
  );


--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux