@Test
  public void testWALSyncWriteException() throws Exception {
    final HRegionForTest region = this.createTable();

    String oldThreadName = Thread.currentThread().getName();
    Thread.currentThread().setName(USER_THREAD_NAME);
    try {
      byte[] rowKey1 = Bytes.toBytes(1);
      byte[] value1 = Bytes.toBytes(3);
      Thread.sleep(2000);
      testWALTimout = true;

      /**
       * The {@link WAL#sync} would timeout and throws {@link WALSyncTimeoutIOException},when
       * {@link HRegion#doWALAppend} catches this exception it aborts the RegionServer.
       */
      try {
        region.put(new Put(rowKey1).addColumn(FAMILY, QUAL, value1));
        fail();
      } catch (WALSyncTimeoutIOException e) {
        assertTrue(e != null);
      }
      assertTrue(region.getRSServices().isAborted());
    } finally {
      Thread.currentThread().setName(oldThreadName);
      testWALTimout = false;
    }
  }
This test is for HBASE-27230. When {@link WAL#sync} timeout, it would throws
{@link WALSyncTimeoutIOException},and when {@link HRegion#doWALAppend} catches this exception
it aborts the RegionServer.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALSyncTimeoutException.java