[ https://issues.apache.org/jira/browse/MRUNIT-166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526907#comment-13526907 ]
Dave Beech commented on MRUNIT-166: ----------------------------------- Hi Patrick. I must admit I'm a little confused by this one. In MRUnit, the TaskAttemptIDs for the mock reducer context and the mock output format context are both created using TaskAttemptID.forName(String), which returns an org.apache.hadoop.mapred.TaskAttemptID. But - the task ID strings are hardcoded to different values in each case, so I'd expect them not to match for that reason, rather than the classes being different. Is this definitely why the comparison fails in your test? > mapreduce reducers are passed mapred taskattemptid/taskid class instances > ------------------------------------------------------------------------- > > Key: MRUNIT-166 > URL: https://issues.apache.org/jira/browse/MRUNIT-166 > Project: MRUnit > Issue Type: Bug > Affects Versions: 1.0.0 > Reporter: Patrick Hunt > > I have a mapreduce API based reducer. When my test runs the setup method is > called with a mapred taskattemptid/taskid. You can see it in the following. > I'm printing the classes of the passed context, taskattemptid, taskid. You > can see that my reducer is getting called through mapreduce.Reduce.run(). > {noformat} > PDH setup context:class > org.apache.hadoop.mapreduce.Reducer$Context$$EnhancerByMockitoWithCGLIB$$fc977043 > PDH setup taskattemptid:class org.apache.hadoop.mapred.TaskAttemptID > PDH setup taskid:class org.apache.hadoop.mapred.TaskID > PDH setup stack: > at foo.FooReducerTest$MyFooReducer.setup(FooReducerTest.java:75) > at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:162) > at > org.apache.hadoop.mrunit.mapreduce.ReduceDriver.run(ReduceDriver.java:139) > at foo.FooReducerTest.testReducer(FooReducerTest.java:120) > {noformat} > this causes my tests to fail due to later invocations of the test are also > exercising a subclass of FileOutputFormat, specifically the method > org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.getRecordWriter(TaskAttemptContext) > getRecordWriter is called with a context that provides mapreduce based > taskattemptid/taskid. > The code is comparing the taskid of setup to getRecordWriter, which fails due > to the classes being different (even though the data, taskid, itself is the > same) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira