mercredi 28 octobre 2015

MRUnit - Test success depends of output order

I have created a small example to figure out how to use MRUnit for testing MapReduce code. The example that I am trying to run is wordcount, so I won't paste the code here since it's familiar to all.

I have written tests using JUnit. What confuses me is that the success of the test depends of the order in which output values are listed.

For example, this test passes:

mapDriver.withInput(new LongWritable(), new Text("Hadoop is cool"))
            .withOutput(new Text("Hadoop"), new IntWritable(1))
            .withOutput(new Text("is"), new IntWritable(1))
            .withOutput(new Text("cool"), new IntWritable(1))
            .runTest();

But this one does not

mapDriver.withInput(new LongWritable(), new Text("Hadoop is cool"))
            .withOutput(new Text("Hadoop"), new IntWritable(1))
            .withOutput(new Text("cool"), new IntWritable(1))
            .withOutput(new Text("is"), new IntWritable(1))
            .runTest();

This is not the behavior that I would expect.

Is this a bug in MRUnit, or is there a reason for such a behavior?

Aucun commentaire:

Enregistrer un commentaire