@Test
  public void ttlUpdateLifeVersionTest() throws StoreException {
    short lifeVersion = 2;
    MockId addedId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time, Utils.getRandomShort(TestUtils.RANDOM),
        Utils.getRandomShort(TestUtils.RANDOM), lifeVersion).get(0);

    MessageInfo info = new MessageInfo(addedId, TTL_UPDATE_RECORD_SIZE, false, true, false, Utils.Infinite_Time, null,
        addedId.getAccountId(), addedId.getContainerId(), time.milliseconds(), (short) (lifeVersion + 1));
    store.updateTtl(Collections.singletonList(info));
    ttlUpdatedKeys.add(addedId);
    StoreInfo storeInfo = store.get(Arrays.asList(addedId), EnumSet.noneOf(StoreGetOptions.class));
    assertEquals(1, storeInfo.getMessageReadSetInfo().size());
    // still the lifeVersion is 2, not 3
    assertEquals(lifeVersion, storeInfo.getMessageReadSetInfo().get(0).getLifeVersion());

    // We can't ttl update it again
    try {
      store.updateTtl(Collections.singletonList(info));
      fail("Should not ttl update again");
    } catch (StoreException e) {
      assertEquals(e.getErrorCode(), StoreErrorCodes.AlreadyUpdated);
    }
    delete(addedId);

    // Add a new put
    addedId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time, Utils.getRandomShort(TestUtils.RANDOM),
        Utils.getRandomShort(TestUtils.RANDOM), lifeVersion).get(0);
    // Use -1 as lifeVersion, should succeed.
    info = new MessageInfo(addedId, TTL_UPDATE_RECORD_SIZE, false, true, false, Utils.Infinite_Time, null,
        addedId.getAccountId(), addedId.getContainerId(), time.milliseconds(), MessageInfo.LIFE_VERSION_FROM_FRONTEND);
    store.updateTtl(Collections.singletonList(info));
    ttlUpdatedKeys.add(addedId);
    storeInfo = store.get(Collections.singletonList(addedId), EnumSet.noneOf(StoreGetOptions.class));
    assertEquals(1, storeInfo.getMessageReadSetInfo().size());
    // still the lifeVersion is 2, not -1
    assertEquals(lifeVersion, storeInfo.getMessageReadSetInfo().get(0).getLifeVersion());
  }
Tests when the lifeVersion for ttl update is not -1.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java