From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Better testing coverage and unified coding for plpgsql loops |
Date: | 2018-01-02 12:20:05 |
Message-ID: | 20180102122005.vhzkbrq6zcw2ck3w@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> However, while I was doing that, it seemed like the tests I was adding
> were mighty repetitive, as many of them were just exactly the same thing
> adjusted for a different kind of loop statement. And so I began to wonder
> why it was that we had five copies of the RC_FOO management logic, no two
> quite alike. If we only had *one* copy then it would not seem necessary
> to have such duplicative test cases for it. A bit of hacking later, and
> I had the management logic expressed as a macro, with only one copy for
> all five kinds of loop.
I'm not entirely sure about this rationale. Improving coverage is of
course an important goal, but it's not the only one: each documented
construct and behavior should be tested also explicitly, to avoid any
inadvertant breakage. You're probably the most careful committer in the
project, but what that means is that some other less careful committer
(present or future) will need to hack this code again in the future and
break some of the cases that you've made to work, because the test cases
only exercise the generic behavior through some specific kind of loop,
and not every individual kind of loop specifically.
In other words, I think testing (the basic behavior of) every construct
separately is worthwhile even if it tests the same code several times.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Pavan Deolasee | 2018-01-02 12:51:51 | Re: Faster inserts with mostly-monotonically increasing values |
Previous Message | Stephen Frost | 2018-01-02 12:08:46 | Re: Add default role 'pg_access_server_files' |