Skip to content

Commit

Permalink
Found and fixed 8 flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yesh385 committed Nov 14, 2023
1 parent cbc5d2d commit c881734
Showing 1 changed file with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -72,6 +73,7 @@
import org.apache.thrift.TException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertNull;
import org.junit.Test;
Expand Down Expand Up @@ -340,7 +342,12 @@ private void deserializeAndSerialize(
// Serialize
assertEquals(PutWritable.class, serDe.getSerializedClass());
PutWritable serializedPut = (PutWritable) serDe.serialize(row, oi);
assertEquals("Serialized data", p.toString(),String.valueOf(serializedPut.getPut()));
Put serializedPutObject = serializedPut.getPut();
assertTrue(p.getFamilyCellMap().equals(serializedPutObject.getFamilyCellMap()));
assertTrue(Arrays.equals(p.getRow(), serializedPutObject.getRow()));
assertEquals(p.getTimestamp(), serializedPutObject.getTimestamp());
assertEquals(p.getDurability(), serializedPutObject.getDurability());
assertEquals(p.getTTL(), serializedPutObject.getTTL());
}

// No specifications default to UTF8 String storage for backwards compatibility
Expand Down Expand Up @@ -805,7 +812,11 @@ private void deserializeAndSerializeHiveMapHBaseColumnFamilyII(

// Serialize
Put serializedPut = ((PutWritable) hbaseSerDe.serialize(row, soi)).getPut();
assertEquals("Serialized data: ", p.toString(), serializedPut.toString());
assertTrue(p.getFamilyCellMap().equals(serializedPut.getFamilyCellMap()));
assertTrue(Arrays.equals(p.getRow(), serializedPut.getRow()));
assertEquals(p.getTimestamp(), serializedPut.getTimestamp());
assertEquals(p.getDurability(), serializedPut.getDurability());
assertEquals(p.getTTL(), serializedPut.getTTL());
}

@Test
Expand Down Expand Up @@ -924,7 +935,11 @@ private void deserializeAndSerializeHivePrefixColumnFamily(HBaseSerDe serDe, Res
Put put = ((PutWritable) serDe.serialize(row, soi)).getPut();

if (p != null) {
assertEquals("Serialized put:", p.toString(), put.toString());
assertTrue(p.getFamilyCellMap().equals(put.getFamilyCellMap()));
assertTrue(Arrays.equals(p.getRow(), put.getRow()));
assertEquals(p.getTimestamp(), put.getTimestamp());
assertEquals(p.getDurability(), put.getDurability());
assertEquals(p.getTTL(), put.getTTL());
}
}

Expand Down Expand Up @@ -1049,7 +1064,11 @@ private void deserializeAndSerializeHBaseCompositeKey(HBaseSerDe serDe, Result r
// Now serialize
Put put = ((PutWritable) serDe.serialize(row, soi)).getPut();

assertEquals("Serialized put:", p.toString(), put.toString());
assertTrue(p.getFamilyCellMap().equals(put.getFamilyCellMap()));
assertTrue(Arrays.equals(p.getRow(), put.getRow()));
assertEquals(p.getTimestamp(), put.getTimestamp());
assertEquals(p.getDurability(), put.getDurability());
assertEquals(p.getTTL(), put.getTTL());
}

@Test
Expand Down Expand Up @@ -1528,7 +1547,11 @@ private void deserializeAndSerializeHBaseValueStruct(HBaseSerDe serDe, Result r,
// Now serialize
Put put = ((PutWritable) serDe.serialize(row, soi)).getPut();

assertEquals("Serialized put:", p.toString(), put.toString());
assertTrue(p.getFamilyCellMap().equals(put.getFamilyCellMap()));
assertTrue(Arrays.equals(p.getRow(), put.getRow()));
assertEquals(p.getTimestamp(), put.getTimestamp());
assertEquals(p.getDurability(), put.getDurability());
assertEquals(p.getTTL(), put.getTTL());
}

private void deserializeAndSerializeHiveAvro(HBaseSerDe serDe, Result r, Put p,
Expand Down

0 comments on commit c881734

Please sign in to comment.