Return-Path: X-Original-To: apmail-accumulo-user-archive@www.apache.org Delivered-To: apmail-accumulo-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2683817352 for ; Wed, 29 Oct 2014 22:28:49 +0000 (UTC) Received: (qmail 98015 invoked by uid 500); 29 Oct 2014 22:28:48 -0000 Delivered-To: apmail-accumulo-user-archive@accumulo.apache.org Received: (qmail 97967 invoked by uid 500); 29 Oct 2014 22:28:48 -0000 Mailing-List: contact user-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@accumulo.apache.org Delivered-To: mailing list user@accumulo.apache.org Received: (qmail 97957 invoked by uid 99); 29 Oct 2014 22:28:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Oct 2014 22:28:48 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mdrob@cloudera.com designates 209.85.214.178 as permitted sender) Received: from [209.85.214.178] (HELO mail-ob0-f178.google.com) (209.85.214.178) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Oct 2014 22:28:45 +0000 Received: by mail-ob0-f178.google.com with SMTP id wm4so3249534obc.9 for ; Wed, 29 Oct 2014 15:27:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=v7wXwwV1MntjaDEEsTXlN5ImeN/31k8x3sgWoXj1ctc=; b=coYkJB2unFdwJMBEJ/sPkg6Hv795cmF8V2Aaqzl3XkXt+UqVzM3dbK534rnOsZOmpC L0GEclaX5YOyGFnafr1QZv4BXsDjw84vIwSWgQBo2taoYsnliDcnPtXdGUF55z7YCHnL nHFKABN/w1GzCrJnyFZ6zr4FJHBzh14IW+ExyulsTAnTiOhIM1W8IamX9sLQBZb5n+O1 KTWTOikFPFcYWCQFs0fvZyneOYc1oJ20QkhudAxwyY2pQc3858cYnVqfGfxZ8vV0MPay I6iVxwjILco/uFsk7UN7UsTkFQWGVIF9R5NJ8jlLTP69Q45tvHNeWun0/zSZ7ZARQcQJ oBFg== X-Gm-Message-State: ALoCoQn9BQZrdwcvHbpJY1MnNWPwQjuGL7nT8qyPRPP0lmN4z4ew3d9qFPWTDxltdgK2jzSO/GrT X-Received: by 10.182.89.194 with SMTP id bq2mr11021190obb.12.1414621659295; Wed, 29 Oct 2014 15:27:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.222.105 with HTTP; Wed, 29 Oct 2014 15:27:19 -0700 (PDT) In-Reply-To: References: From: Mike Drob Date: Wed, 29 Oct 2014 17:27:19 -0500 Message-ID: Subject: Re: Testing Map Reduce Jobs To: user@accumulo.apache.org Content-Type: multipart/alternative; boundary=089e013cc45e7e882705069745ac X-Virus-Checked: Checked by ClamAV on apache.org --089e013cc45e7e882705069745ac Content-Type: text/plain; charset=UTF-8 If you launch a MapReduce job in your test code, without having a cluster present, then it will default into a local runner. This could be easy if you invoke your job through something like ToolRunner.run(). Or just build a job and invoke it directly. So you don't really need a mini-mr or yarn cluster for this, 90% of the time. As far as integrating that with a mini-accumulo... if you start a MiniAccumuloCluster manually and keep a reference to it (which you should anyway because you will need to stop it eventually) then you can use that to populate your AccumuloInputFormat configuration (assuming you are using it). Something like... @Before public void setUp() throws Exception { // Start the Accumulo Cluster mac = new MiniAccumuloCluster(root.newFolder(), ACCUMULO_PASS); mac.start(); // Get first connection to create user mac.getConnector(ACCUMULO_USER, ACCUMULO_PASS); } @Test public void setUp() throws Exception { AccumuloInputFormat.setZooKeeperInstance(job, ClientConfiguration.loadDefault().withZkHosts(mac.getZooKeepers()).withInstance(mac.getInstanceName())); // .. and other settings boolean success = job.waitForCompletion(false); assertTrue("Job failed!", success); } @After public void tearDown() throws Exception { mac.stop(); } Not sure if this is helpful, but hopefully is enough to point you in the right direction. If you have more questions, please clarify. On Wed, Oct 29, 2014 at 4:16 PM, Ariel Valentin wrote: > I am looking for some guidance that will help me write better tests for > our map reduce jobs. My current jobs are tested using MRUnit, which covers > most of the "logic" but I feel like I am missing good "end-to-end" > developer tests. > > I took a look at the tests for mapred classes but I am not sure that it > achieves my goal of an end-to-end test because of the use of MockInstance. > > https://github.com/apache/accumulo/blob/master/mapreduce/src/test/java/org/apache/accumulo/core/client/mapred{,reduce}/ > > For me the characteristic of a end-to-end test that I would find valuable > is a suite that one could execute using mini-{accumulo,yarn,et.al.} but I > don't see any examples of how one would go about making those components > work in concert with each other. > > Does anyone have any guidance when it comes to writing automated developer > end-to-end tests? > > What kinds of testing strategies are people out there using for MR jobs? > > Thanks, > Ariel Valentin > e-mail: ariel@arielvalentin.com > website: http://blog.arielvalentin.com > skype: ariel.s.valentin > twitter: arielvalentin > linkedin: http://www.linkedin.com/profile/view?id=8996534 > --------------------------------------- > *simplicity *communication > *feedback *courage *respect > --089e013cc45e7e882705069745ac Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
If you launch a MapReduce job in your test code,= without having a cluster present, then it will default into a local runner= . This could be easy if you invoke your job through something like ToolRunn= er.run(). Or just build a job and invoke it directly. So you don't real= ly need a mini-mr or yarn cluster for this, 90% of the time.

A= s far as integrating that with a mini-accumulo... if you start a MiniAccumu= loCluster manually and keep a reference to it (which you should anyway beca= use you will need to stop it eventually) then you can use that to populate = your AccumuloInputFormat configuration (assuming you are using it).

=
Something like...

=C2=A0 @Before
=C2=A0 public void se= tUp() throws Exception {
=C2=A0=C2=A0=C2=A0 // Start the Accumulo Cluste= r
=C2=A0=C2=A0=C2=A0 mac =3D new MiniAccumuloCluster(root.newFolder(), A= CCUMULO_PASS);
=C2=A0=C2=A0=C2=A0 mac.start();

=C2=A0=C2=A0=C2=A0= // Get first connection to create user
=C2=A0=C2=A0=C2=A0 mac.getConnec= tor(ACCUMULO_USER, ACCUMULO_PASS);
=C2=A0 }

=C2=A0 @Te= st
=C2=A0 public void setUp() throws Exception {
=C2=A0=C2= =A0=C2=A0 AccumuloInputFormat.setZooKeeperInstance(job, ClientConfiguration= .loadDefault().withZkHosts(mac.getZooKeepers()).withInstance(mac.getInstanc= eName()));
=C2=A0=C2=A0=C2=A0 // .. and other settings
=C2=A0=C2=A0=C2=A0 boolean success =3D job.waitForCompletion(fa= lse);
=C2=A0=C2=A0=C2=A0 assertTrue("Job failed!", = success);
=C2=A0 }

=C2=A0 @After
=C2=A0 public void= tearDown() throws Exception {
=C2=A0=C2=A0=C2=A0 mac.stop();
=C2=A0 = }

Not sure if this is helpful, but hopefully is enough to= point you in the right direction. If you have more questions, please clari= fy.



On Wed, Oct 29, 2014 at 4:16 PM, Ariel Valentin <ariel@arielvalentin.com> wrote:
I am looking for some guidance that will help = me write better tests for our map reduce jobs. My current jobs are tested u= sing MRUnit, which covers most of the "logic" but I feel like I a= m missing good "end-to-end" developer tests.=C2=A0

=
I took a look at the tests for mapred classes but I am not sure = that it achieves my goal of an end-to-end test because of the use of MockIn= stance.
https://github.com/apache/accumulo/blob/master/mapred= uce/src/test/java/org/apache/accumulo/core/client/mapred{,reduce}/
<= /div>

For me the characteristic of a end-to-end tes= t that I would find valuable is a suite that one could execute using mini-{= accumulo,yarn,et.al.} but I = don't see any examples of how one would go about making those component= s work in concert with each other.=C2=A0

Doe= s anyone have any guidance when it comes to writing automated developer end= -to-end tests?=C2=A0

What kinds of testing strateg= ies are people out there using for MR jobs?

Thanks,
Ariel Valentin
e-mail: ariel@arielvalentin.com
website: http://blog.arielva= lentin.com
skype: ariel.s.valentin
twitter: arielvalentinlinkedin:=C2=A0http://www.linkedin.com/profile/view?id=3D8996534=
---------------------------------------
*simplicity *communication*feedback *courage *respect

--089e013cc45e7e882705069745ac--