[ 
https://issues.apache.org/jira/browse/MRUNIT-91?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13237621#comment-13237621
 ] 

Jim Donofrio commented on MRUNIT-91:
------------------------------------

Sorry my example wasnt correct but I think you know what I meant. I was trying 
this on a mapper but a mapper can only take one input.

The below tests for a reducer or mapreduce driver fail with 0 Error(s) because 
of a mismatch in the output vs expected output size:

  @Test
  public void testDuplicateOutputOrderInsensitive() {
    thrown
        .expectAssertionErrorMessage("1 Error(s): (Received unexpected output 
(foo, bar))");
    final ReduceDriver<Text, Text, Text, Text> driver = ReduceDriver
        .newReduceDriver(new IdentityReducer<Text, Text>());
    driver.withInputKey(new Text("foo")).withInputValue(new Text("bar"))
        .withInputValue(new Text("bar"))
        .withOutput(new Text("foo"), new Text("bar")).runTest(false);
  }

  @Test
  public void testDuplicateOutputOrderInsensitive() {
    thrown
        .expectAssertionErrorMessage("1 Error(s): (Received unexpected output 
(foo, bar))");
    driver2.withMapper(new IdentityMapper<Text, Text>()).withReducer(
        new IdentityReducer<Text, Text>());
    driver2.withInput(new Text("foo"), new Text("bar"))
        .withInput(new Text("foo"), new Text("bar"))
        .withOutput(new Text("foo"), new Text("bar")).runTest(false);
  }
                
> runTest() should optionally ignore output order
> -----------------------------------------------
>
>                 Key: MRUNIT-91
>                 URL: https://issues.apache.org/jira/browse/MRUNIT-91
>             Project: MRUnit
>          Issue Type: Improvement
>    Affects Versions: 0.8.1
>            Reporter: William McNeill
>            Priority: Minor
>              Labels: order
>             Fix For: 1.0.0
>
>         Attachments: MRUNIT-91-1.patch, MRUNIT-91.patch
>
>
> Currently MapDriver.runTest() assumes that the order of pairs emitted by the 
> mapper matches the order of the MapDriver.addOutput() calls. However, there 
> are valid mappers that for a given input pair produce output pairs whose 
> order is unspecified for testing purposes. (For example, if the mapper being 
> tested uses a set object for deduplication before emission.) runTest() cannot 
> be used to test these kinds of mappers.
> A workaround is to not use runTest() but instead put the output of run() into 
> a Set and assert that the contents of the set are correct, bypassing MRUnit's 
> validation code.
> A possible improvement would be to add a boolean orderMatters parameter to 
> MapDriver.runTest(), invoking an order-insensitive version of 
> TestDriver.validate() when orderMatters is false and the existing version 
> otherwise.
> For clarity's sake only mappers are discussed in this feature request, but 
> the same applies to reducers as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to