mrunit-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dipesh Khakhkhar <dipeshsoftw...@gmail.com>
Subject Re: How to set number of reduce tasks in MRUnit's mocked context object
Date Thu, 29 Nov 2012 02:06:17 GMT
Hi Tom,

Thanks for replying. I completely agree with you - there will be only one
Reduce task in unit test and when we query the mock object to get number of
reduce task it should return 1 instead of zero.

I'm using to calculate a custom counter and since mocked Context object
returns it 0 my test is failing.

Can we set it externally this value using MRUnit 0.9*?

Thanks.
-Dipesh

On Wed, Nov 28, 2012 at 3:32 PM, Tom Wheeler <twheeler@cloudera.com> wrote:

> Hi Dipesh,
>
> I haven't looked at that part of the code, but based on my
> understanding of MRUnit, it doesn't (generally) make sense to have
> multiple reduce tasks in a unit test.  If your goal is to test a
> custom partitioner, then I know that's not yet supported (MRUNIT-128).
>
> You could maybe make the case that in a unit test you should be able
> to set an arbitrary value in the configuration object and then be able
> to to retrieve that using the corresponding get method.  Maybe you
> could clarify what you want to accomplish by setting the number of
> reduce tasks.
>
> Tom Wheeler
>
> On Wed, Nov 28, 2012 at 5:11 PM, Dipesh Khakhkhar
> <dipeshsoftware@gmail.com> wrote:
> > When I am running a reducer test - then this method should return 1
> without
> > requiring any further mocking. Correct? Same is true for Mapper (I have
> not
> > tried it though).
> >
> > Will it require an enhancement in the framework or it can be done
> > externally.
> >
> > Thanks.
> >
> >
> > On Wed, Nov 28, 2012 at 2:59 PM, Dipesh Khakhkhar <
> dipeshsoftware@gmail.com>
> > wrote:
> >>
> >> I'm calling getNumReduceTasks() method in my reducer and in my MRUnit
> >> test, framework has created a mock context object but when I call
> >> getNumReduceTasks it is returning 0.
> >>
> >> I have tried setting it to Configuration object too but it didn't help.
> >>
> >> How can i set getNumReduceTasks() to return a desired number here?
> >>
> >> Thanks.
> >
> >
>

Mime
View raw message