From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Stéphane Klein <contact@stephane-klein.info>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How can I include sql file in pgTAP unittest?
Date: Fri, 2 Mar 2018 10:01:48 -0800
Message-ID: <9d279104-44f0-417d-7448-8da4f304eecd@aklaver.com> (raw)
In-Reply-To: <CADKxhpekvOw+EWU7cq1EHww1PCd_qtP_KokFBts9Oqky6muk=A@mail.gmail.com>
References: <CADKxhpd0Y4oJHy-O=TAdnzTgs-UB1H5FShmx5qWQuKT3FmLndQ@mail.gmail.com>
<c5a7c0d8-b057-4262-5122-c338f6da97a0@aklaver.com>
<CADKxhpekvOw+EWU7cq1EHww1PCd_qtP_KokFBts9Oqky6muk=A@mail.gmail.com>
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@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, contact@stephane-klein.info
Subject: Re: How can I include sql file in pgTAP unittest?
In-Reply-To: <9d279104-44f0-417d-7448-8da4f304eecd@aklaver.com>
References: <CADKxhpd0Y4oJHy-O=TAdnzTgs-UB1H5FShmx5qWQuKT3FmLndQ@mail.gmail.com> <c5a7c0d8-b057-4262-5122-c338f6da97a0@aklaver.com> <CADKxhpekvOw+EWU7cq1EHww1PCd_qtP_KokFBts9Oqky6muk=A@mail.gmail.com> <9d279104-44f0-417d-7448-8da4f304eecd@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox