@Test
public void addOrDeleteTimeSeries() throws ConfigAdjusterException {

  int totalTimeseries = 0;
  for (int i = 1; i < 100; i++) {
    IoTDBConfigDynamicAdapter.getInstance().addOrDeleteStorageGroup(1);
  }
  IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(100);
  for (int i = 1; i < 1000000; i++) {
    try {
      IoTDBConfigDynamicAdapter.getInstance().addOrDeleteTimeSeries(1);
      if (i % 10 == 0) {
        IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(i);
      }
      totalTimeseries += 1;
      assertEquals(IoTDBConfigDynamicAdapter.getInstance().getCurrentMemTableSize(),
          CONFIG.getMemtableSizeThreshold());
      assertEquals(IoTDBConfigDynamicAdapter.getInstance().getTotalTimeseries(),
          totalTimeseries);
    } catch (ConfigAdjusterException e) {
      assertEquals(String.format(ConfigAdjusterException.ERROR_MSG_FORMAT,
          IoTDBConfigDynamicAdapter.ADD_TIMESERIES), e.getMessage());
      assertEquals(IoTDBConfigDynamicAdapter.getInstance().getTotalTimeseries(),
          totalTimeseries);
      break;
    }
  }
}