Skip site navigation (1) Skip section navigation (2)

Re: Hot Standby on git

From: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hot Standby on git
Date: 2009-09-26 14:45:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On 09/26/2009 10:04 AM, Simon Riggs wrote:
>> If you think there's
>> something useful I could do, let me know and I'll take a look.
> I feel like I need a better way of unit testing new code. Some of the
> code in the patch is to handle corner cases, so recreating them is
> fairly hard. It is a nagging feeling that I am missing some knowledge
> here and would welcome some insight, or research, into better ways of
> doing general case unit testing.

You might try and steal ideas from EasyMock / PowerMock - but not sure 
how well the ideas map to C.

Generally it means allowing the functions to be called from a "mock" 
environment, where subroutine calls that might be called are stubbed out 
to return sample data that would simulate your scenario. Object oriented 
languages that require every object to provide an interface where most 
object methods can be overridden are more ideal for performing this sort 
of test.

I rarely ever see this sort of stuff in FOSS projects, and never that I 
can remember in FOSS C projects. It's not easy, though.

I assume you are doing it through code changing right now. Commenting 
out lines, replacing them with others, etc?


Mark Mielke<mark(at)mielke(dot)cc>

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2009-09-26 15:43:46
Subject: Re: WIP - syslogger infrastructure changes
Previous:From: Simon RiggsDate: 2009-09-26 14:04:37
Subject: Re: Hot Standby on git

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group