From 97f8d3aab755a1a89a296f1bef378e52bd29db0d Mon Sep 17 00:00:00 2001 From: Andrey Kurilov Date: Fri, 30 Jun 2017 20:14:30 +0300 Subject: [PATCH] sys tests fixes --- .../tests/system/ChainWithDelayTest.java | 2 +- .../system/CircularReadSingleItemTest.java | 2 +- .../tests/system/CreateLimitBySizeTest.java | 2 +- .../DeleteUsingInputPathLimitByRateTest.java | 2 +- .../ReadUsingInputFileLimitByCountTest.java | 2 +- .../UpdateUsingInputFileLimitByTimeTest.java | 2 +- .../tests/system/WeightedLoadTest.java | 2 +- .../system/deprecated/ChainWithDelayTest.java | 142 ------------ .../system/deprecated/CircularAppendTest.java | 190 ---------------- .../CircularReadSingleItemTest.java | 179 --------------- .../system/deprecated/CircularUpdateTest.java | 205 ----------------- ...esUsingDirectoryListingItemsInputTest.java | 175 --------------- .../CopyFilesUsingItemsInputFileTest.java | 184 ---------------- ...reateBigDataItemsMetricsThresholdTest.java | 128 ----------- .../deprecated/CreateBigDataItemsTest.java | 192 ---------------- .../system/deprecated/CreateByCountTest.java | 189 ---------------- .../system/deprecated/CreateByTimeTest.java | 186 ---------------- .../CreateNoLimitHighConcurrencyTest.java | 77 ------- .../system/deprecated/MixedLoadTest.java | 118 ---------- .../deprecated/ReadBigDataItemsTest.java | 180 --------------- .../deprecated/ReadBucketListingTest.java | 170 --------------- .../deprecated/ReadCircularUpdatedTest.java | 206 ------------------ .../ReadMultipleFixedFileRangesTest.java | 159 -------------- .../ReadMultipleFixedRangesTest.java | 152 ------------- .../ReadMultipleRandomFileRangesTest.java | 159 -------------- .../ReadMultipleRandomRangesTest.java | 151 ------------- .../deprecated/ReadSingleFixedRangesTest.java | 151 ------------- .../ReadSingleRandomFileRangesTest.java | 159 -------------- ...eadSmallDataItemsMetricsThresholdTest.java | 169 -------------- .../ReadUpdatedMultipleFixedRangesTest.java | 162 -------------- .../ReadUpdatedMultipleRandomRangesTest.java | 156 ------------- .../deprecated/ReadVerificationFailTest.java | 165 -------------- .../tests/system/deprecated/S3MpuTest.java | 164 -------------- .../system/deprecated/SwiftCreateDloTest.java | 153 ------------- .../SwiftReadContainerListingTest.java | 174 --------------- ...lsReadUpdatedMultipleRandomRangesTest.java | 173 --------------- .../system/deprecated/WeightedLoadTest.java | 122 ----------- 37 files changed, 7 insertions(+), 4897 deletions(-) delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ChainWithDelayTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularAppendTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularReadSingleItemTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularUpdateTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingDirectoryListingItemsInputTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingItemsInputFileTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsMetricsThresholdTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByCountTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByTimeTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateNoLimitHighConcurrencyTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/MixedLoadTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBigDataItemsTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBucketListingTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadCircularUpdatedTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedFileRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomFileRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleFixedRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleRandomFileRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSmallDataItemsMetricsThresholdTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleFixedRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleRandomRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadVerificationFailTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/S3MpuTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftCreateDloTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftReadContainerListingTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/TlsReadUpdatedMultipleRandomRangesTest.java delete mode 100644 tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/WeightedLoadTest.java diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/ChainWithDelayTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/ChainWithDelayTest.java index 1dd6ee0e44..956f8e9372 100644 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/ChainWithDelayTest.java +++ b/tests/system/src/test/java/com/emc/mongoose/tests/system/ChainWithDelayTest.java @@ -95,7 +95,7 @@ public static void setUpClass() TimeUnit.SECONDS.timedJoin(runner, TIME_LIMIT + 5); FINISHED_IN_TIME = !runner.isAlive(); runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); + LoadJobLogFileManager.flushAll(); STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); TimeUnit.SECONDS.sleep(10); } diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/CircularReadSingleItemTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/CircularReadSingleItemTest.java index 0fe89cb2c7..4cf2d6f9f9 100644 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/CircularReadSingleItemTest.java +++ b/tests/system/src/test/java/com/emc/mongoose/tests/system/CircularReadSingleItemTest.java @@ -104,7 +104,7 @@ public static void setUpClass() TimeUnit.MINUTES.timedJoin(runner, 65); // 1m + up to 5s for the precondition job FINISHED_IN_TIME = !runner.isAlive(); runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); + LoadJobLogFileManager.flushAll(); TimeUnit.SECONDS.sleep(10); } diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/CreateLimitBySizeTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/CreateLimitBySizeTest.java index a412134c90..1b3bfa9a53 100644 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/CreateLimitBySizeTest.java +++ b/tests/system/src/test/java/com/emc/mongoose/tests/system/CreateLimitBySizeTest.java @@ -112,7 +112,7 @@ public static void setUpClass() TimeUnit.SECONDS.timedJoin(runner, 1000); FINISHED_IN_TIME = !runner.isAlive(); runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); + LoadJobLogFileManager.flushAll(); TimeUnit.SECONDS.sleep(10); } diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/DeleteUsingInputPathLimitByRateTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/DeleteUsingInputPathLimitByRateTest.java index 181931aea8..2f57f9a993 100644 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/DeleteUsingInputPathLimitByRateTest.java +++ b/tests/system/src/test/java/com/emc/mongoose/tests/system/DeleteUsingInputPathLimitByRateTest.java @@ -90,7 +90,7 @@ public static void setUpClass() } catch(final Throwable t) { LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); } - LoadJobLogFileManager.flush(STEP_NAME); + LoadJobLogFileManager.flushAll(); TimeUnit.SECONDS.sleep(10); } diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/ReadUsingInputFileLimitByCountTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/ReadUsingInputFileLimitByCountTest.java index 2614eb2702..5f481d61e3 100644 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/ReadUsingInputFileLimitByCountTest.java +++ b/tests/system/src/test/java/com/emc/mongoose/tests/system/ReadUsingInputFileLimitByCountTest.java @@ -79,7 +79,7 @@ public static void setUpClass() } catch(final Throwable t) { LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); } - LoadJobLogFileManager.flush(STEP_NAME); + LoadJobLogFileManager.flushAll(); TimeUnit.SECONDS.sleep(10); } diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/UpdateUsingInputFileLimitByTimeTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/UpdateUsingInputFileLimitByTimeTest.java index 42e984302e..cba976511a 100644 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/UpdateUsingInputFileLimitByTimeTest.java +++ b/tests/system/src/test/java/com/emc/mongoose/tests/system/UpdateUsingInputFileLimitByTimeTest.java @@ -87,7 +87,7 @@ public static void setUpClass() } catch(final Throwable t) { LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); } - LoadJobLogFileManager.flush(STEP_NAME); + LoadJobLogFileManager.flushAll(); TimeUnit.SECONDS.sleep(10); } diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/WeightedLoadTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/WeightedLoadTest.java index 6114054de4..7088616401 100644 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/WeightedLoadTest.java +++ b/tests/system/src/test/java/com/emc/mongoose/tests/system/WeightedLoadTest.java @@ -120,7 +120,7 @@ public static void setUpClass() TimeUnit.SECONDS.timedJoin(runner, 100); FINISHED_IN_TIME = !runner.isAlive(); runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); + LoadJobLogFileManager.flushAll(); TimeUnit.SECONDS.sleep(10); } diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ChainWithDelayTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ChainWithDelayTest.java deleted file mode 100644 index 42758b909f..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ChainWithDelayTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.net.NetUtil; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.EnvUtil; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.Constants.M; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; - -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -/** - Created by kurila on 28.03.17. - */ - -public class ChainWithDelayTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "mixed", "chain-with-delay.json" - ); - private static final int DELAY_SECONDS = 60; - private static final int TIME_LIMIT = 180; - private static final String ZONE1_ADDR = "127.0.0.1"; - private static final String ZONE2_ADDR; - static { - try { - ZONE2_ADDR = NetUtil.getHostAddrString(); - } catch(final Exception e) { - throw new RuntimeException(e); - } - } - - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - EnvUtil.replace( - new HashMap() { - { - put("ZONE1_ADDRS", ZONE1_ADDR); - put("ZONE2_ADDRS", ZONE2_ADDR); - } - } - ); - STEP_NAME = ChainWithDelayTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--storage-driver-concurrency=10"); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--test-step-limit-time=" + TIME_LIMIT); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - SCENARIO.run(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } finally { - try { - SCENARIO.close(); - } catch(final Throwable tt) { - LogUtil.exception(Level.ERROR, tt, "Failed to close the scenario"); - } - } - } - ); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, TIME_LIMIT + 5); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - - public void testIoTraceFile() - throws Exception { - final Map timingMap = new HashMap<>(); - String storageNode; - String itemPath; - IoType ioType; - long reqTimeStart; - long duration; - Long prevOpFinishTime; - final List ioTraceRecords = getIoTraceLogRecords(); - for(final CSVRecord ioTraceRec : ioTraceRecords) { - storageNode = ioTraceRec.get("StorageNode"); - itemPath = ioTraceRec.get("ItemPath"); - ioType = IoType.values()[Integer.parseInt(ioTraceRec.get("IoTypeCode"))]; - reqTimeStart = Long.parseLong(ioTraceRec.get("ReqTimeStart[us]")); - duration = Long.parseLong(ioTraceRec.get("Duration[us]")); - switch(ioType) { - case CREATE: - assertTrue(storageNode.startsWith(ZONE1_ADDR)); - timingMap.put(itemPath, reqTimeStart + duration); - break; - case READ: - assertTrue(storageNode.startsWith(ZONE2_ADDR)); - prevOpFinishTime = timingMap.get(itemPath); - if(prevOpFinishTime == null) { - fail("No create I/O trace record for \"" + itemPath + "\""); - } else { - assertTrue((reqTimeStart - prevOpFinishTime) / M > DELAY_SECONDS); - } - break; - default: - fail("Unexpected I/O type: " + ioType); - } - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularAppendTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularAppendTest.java deleted file mode 100644 index e131080fd1..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularAppendTest.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.math3.stat.Frequency; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 06.02.17. - * 2.1.1.1.2. Small Data Items (16KB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 4.2. Small Concurrency Level (2-10) - * 5. Circularity - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.4.3.4. Append - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class CircularAppendTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "circular", "append.json" - ); - private static final SizeInBytes EXPECTED_INITIAL_SIZE = new SizeInBytes("16KB"); - private static final SizeInBytes EXPECTED_FINAL_SIZE = new SizeInBytes("32KB-1MB"); - private static final int EXPECTED_CONCURRENCY = 10; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE_0 = "circular-append-before.csv"; - private static final String ITEM_OUTPUT_FILE_1 = "circular-append-after.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CircularAppendTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_0)); - Files.delete(Paths.get(ITEM_OUTPUT_FILE_1)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, 65); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - try { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.UPDATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_INITIAL_SIZE, 31100, 0, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } catch(final FileNotFoundException ignored) { - // there may be no metrics file if append step duration is less than 10s - } - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.UPDATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_INITIAL_SIZE, 0, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.UPDATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_INITIAL_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertTrue( - "There should be more than " + EXPECTED_COUNT + - " records in the I/O trace log file, but got: " + ioTraceRecords.size(), - EXPECTED_COUNT < ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.UPDATE.ordinal(), EXPECTED_INITIAL_SIZE); - } - } - - public void testUpdatedItemsOutputFile() - throws Exception { - final List items = new ArrayList<>(); - try(final BufferedReader br = new BufferedReader(new FileReader(ITEM_OUTPUT_FILE_1))) { - final CSVParser csvParser = CSVFormat.RFC4180.parse(br); - for(final CSVRecord csvRecord : csvParser) { - items.add(csvRecord); - } - } - final int itemIdRadix = CONFIG.getItemConfig().getNamingConfig().getRadix(); - final Frequency freq = new Frequency(); - String itemPath, itemId; - long itemOffset; - long itemSize; - for(final CSVRecord itemRec : items) { - itemPath = itemRec.get(0); - itemId = itemPath.substring(itemPath.lastIndexOf('/') + 1); - itemOffset = Long.parseLong(itemRec.get(1), 0x10); - assertEquals(Long.parseLong(itemId, itemIdRadix), itemOffset); - freq.addValue(itemOffset); - itemSize = Long.parseLong(itemRec.get(2)); - assertTrue( - "Expected size: " + EXPECTED_FINAL_SIZE.toString() + ", actual: " + itemSize, - EXPECTED_FINAL_SIZE.getMin() <= itemSize && itemSize <= EXPECTED_FINAL_SIZE.getMax() - ); - assertEquals("0/0", itemRec.get(3)); - } - assertEquals(EXPECTED_COUNT, freq.getUniqueCount()); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularReadSingleItemTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularReadSingleItemTest.java deleted file mode 100644 index e8e291d5dc..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularReadSingleItemTest.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; - -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 06.02.17. - Covered use cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 4.2. Small Concurrency Level (2-10) - * 5. Circularity - * 6.2.2. Limit Load Job by Processed Item Count - * 6.2.5. Limit Load Job by Time - * 8.2.1. Create New Items - * 8.3.1. Read With Disabled Validation - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class CircularReadSingleItemTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "circular", "read.json" - ); - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("100KB"); - private static final int LOAD_CONCURRENCY = 10; - private static final String ITEM_OUTPUT_FILE = "circular-read.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CircularReadSingleItemTest.class.getSimpleName(); - try { - Files.delete(Paths.get("circular-read.csv")); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 65); // 1m + up to 5s for the precondition job - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 2 metrics records in the log file", - metricsLogRecords.size() > 1 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - 0, 60, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, - ITEM_DATA_SIZE, 0, 60 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertTrue( - "There should be more than 1 record in the I/O trace log file", - ioTraceRecords.size() > 1 - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), ITEM_DATA_SIZE); - } - } - - public void testItemsOutputFile() - throws Exception { - final List items = new ArrayList<>(); - try(final BufferedReader br = new BufferedReader(new FileReader(ITEM_OUTPUT_FILE))) { - final CSVParser csvParser = CSVFormat.RFC4180.parse(br); - for(final CSVRecord csvRecord : csvParser) { - items.add(csvRecord); - } - } - assertEquals(1, items.size()); - final int itemIdRadix = CONFIG.getItemConfig().getNamingConfig().getRadix(); - String itemPath, itemId; - long itemOffset; - long itemSize; - String modLayerAndMask; - final CSVRecord itemRec = items.get(0); - itemPath = itemRec.get(0); - itemId = itemPath.substring(itemPath.lastIndexOf('/') + 1); - itemOffset = Long.parseLong(itemRec.get(1), 0x10); - assertEquals(Long.parseLong(itemId, itemIdRadix), itemOffset); - itemSize = Long.parseLong(itemRec.get(2)); - assertEquals(ITEM_DATA_SIZE.get(), itemSize); - modLayerAndMask = itemRec.get(3); - assertEquals("0/0", modLayerAndMask); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularUpdateTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularUpdateTest.java deleted file mode 100644 index a7495ce0e6..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CircularUpdateTest.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.math3.stat.Frequency; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 06.02.17. - * 2.1.1.1.2. Small Data Items (1KB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 4.2. Small Concurrency Level (2-10) - * 5. Circularity - * 6.2.2. Limit Load Job by Processed Item Count - * 6.2.5. Limit Load Job by Time - * 8.2.1. Create New Items - * 8.4.2.2. Multiple Random Ranges Update - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class CircularUpdateTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "circular", "update.json" - ); - private static final SizeInBytes EXPECTED_PAYLOAD_SIZE = new SizeInBytes("1-1KB"); - private static final int EXPECTED_CONCURRENCY = 10; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE_0 = "circular-update-0.csv"; - private static final String ITEM_OUTPUT_FILE_1 = "circular-update-1.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CircularUpdateTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_0)); - Files.delete(Paths.get(ITEM_OUTPUT_FILE_1)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 65); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.UPDATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_PAYLOAD_SIZE, 0, 60, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.UPDATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_PAYLOAD_SIZE, 0, 60 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.UPDATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_PAYLOAD_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertTrue( - "There should be more than " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT < ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.UPDATE.ordinal(), EXPECTED_PAYLOAD_SIZE); - } - } - - public void testUpdatedItemsOutputFile() - throws Exception { - final List items = new ArrayList<>(); - try(final BufferedReader br = new BufferedReader(new FileReader(ITEM_OUTPUT_FILE_1))) { - final CSVParser csvParser = CSVFormat.RFC4180.parse(br); - for(final CSVRecord csvRecord : csvParser) { - items.add(csvRecord); - } - } - final int itemIdRadix = CONFIG.getItemConfig().getNamingConfig().getRadix(); - final Frequency freq = new Frequency(); - String itemPath, itemId; - long itemOffset; - long itemSize; - String modLayerAndMask[]; - String rangesMask; - char rangesMaskChars[]; - int layer; - BitSet mask; - for(final CSVRecord itemRec : items) { - itemPath = itemRec.get(0); - itemId = itemPath.substring(itemPath.lastIndexOf('/') + 1); - itemOffset = Long.parseLong(itemRec.get(1), 0x10); - assertEquals(Long.parseLong(itemId, itemIdRadix), itemOffset); - freq.addValue(itemOffset); - itemSize = Long.parseLong(itemRec.get(2)); - assertTrue(EXPECTED_PAYLOAD_SIZE.getMin() <= itemSize && itemSize <= EXPECTED_PAYLOAD_SIZE.getMax()); - modLayerAndMask = itemRec.get(3).split("/"); - assertEquals("Modification record should contain 2 parts", 2, modLayerAndMask.length); - layer = Integer.parseInt(modLayerAndMask[0], 0x10); - rangesMask = modLayerAndMask[1]; - if(rangesMask.length() == 0) { - rangesMaskChars = ("00" + rangesMask).toCharArray(); - } else if(rangesMask.length() % 2 == 1) { - rangesMaskChars = ("0" + rangesMask).toCharArray(); - } else { - rangesMaskChars = rangesMask.toCharArray(); - } - mask = BitSet.valueOf(Hex.decodeHex(rangesMaskChars)); - if(layer == 0) { - assertTrue( - "The modification record \"" + itemRec.get(3) + "\" is not updated", - mask.cardinality() > 0 - ); - } - } - assertEquals(items.size(), freq.getUniqueCount()); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingDirectoryListingItemsInputTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingDirectoryListingItemsInputTest.java deleted file mode 100644 index 9a02177702..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingDirectoryListingItemsInputTest.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.FileStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 04.03.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (4KB) - * 2.2.2. Items Path Listing Input - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.2. Small Concurrency Level (2-10) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 6.2.6. Limit Load Job by End of Items Input - * 8.2.1. Create New Items - * 8.2.2. Copy Mode - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.4.2. Job Configuration Inheritance - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.3. Precondition Load Job - * 9.5.5. Sequential Job - * 10.1.2. Many Local Separate Storage Driver Services (at different ports) - * 10.2.2. Destination Path Precondition Hook - * 10.3. Filesystem Storage Driver - */ - -public class CopyFilesUsingDirectoryListingItemsInputTest -extends FileStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "copy", "files-from-dir.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("4KB"); - private static final int EXPECTED_CONCURRENCY = 10; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_INPUT_PATH = "/tmp/src-dir"; - private static final String ITEM_OUTPUT_PATH = "/tmp/dst-dir"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CopyFilesUsingDirectoryListingItemsInputTest.class.getSimpleName(); - try { - FileUtils.deleteDirectory(new File(ITEM_INPUT_PATH)); - } catch(final Exception ignored) { - } - try { - FileUtils.deleteDirectory(new File(ITEM_OUTPUT_PATH)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - FileStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, 20); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - FileStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - String nextItemPath, nextItemId; - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), EXPECTED_ITEM_DATA_SIZE); - nextItemPath = ioTraceRecord.get("ItemPath"); - Assert.assertTrue( - "File \"" + nextItemPath + "\" doesn't exist", Files.exists(Paths.get(nextItemPath)) - ); - nextItemId = nextItemPath.substring(nextItemPath.lastIndexOf(File.separatorChar) + 1); - Assert.assertTrue( - "File \"" + ITEM_INPUT_PATH + File.separatorChar + nextItemId + "\" doesn't exist", - Files.exists(Paths.get(ITEM_INPUT_PATH, nextItemId)) - ); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingItemsInputFileTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingItemsInputFileTest.java deleted file mode 100644 index 8069129571..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CopyFilesUsingItemsInputFileTest.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.FileStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; - -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; - -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - Created by andrey on 04.03.17. - Covered use cases: - Covered use cases: - * 2.1.1.1.2. Small Data Items (4KB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.2. Small Concurrency Level (2-10) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 6.2.6. Limit Load Job by End of Items Input - * 8.2.1. Create New Items - * 8.2.2. Copy Mode - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.4.2. Job Configuration Inheritance - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.3. Precondition Load Job - * 9.5.5. Sequential Job - * 10.1.2. Many Local Separate Storage Driver Services (at different ports) - * 10.2.2. Destination Path Precondition Hook - * 10.3. Filesystem Storage Driver - */ - -public class CopyFilesUsingItemsInputFileTest -extends FileStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "copy", "file.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("4KB"); - private static final int EXPECTED_CONCURRENCY = 10; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_INPUT_FILE = "files2copy.csv"; - private static final String ITEM_INPUT_PATH = "/tmp/src-dir"; - private static final String ITEM_OUTPUT_PATH = "/tmp/dst-dir"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CopyFilesUsingItemsInputFileTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_INPUT_FILE)); - } catch(final Exception ignored) { - } - try { - FileUtils.deleteDirectory(new File(ITEM_INPUT_PATH)); - } catch(final Exception ignored) { - } - try { - FileUtils.deleteDirectory(new File(ITEM_OUTPUT_PATH)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - FileStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, 20); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - FileStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - String nextItemPath, nextItemId; - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), EXPECTED_ITEM_DATA_SIZE); - nextItemPath = ioTraceRecord.get("ItemPath"); - Assert.assertTrue( - "File \"" + nextItemPath + "\" doesn't exist", Files.exists(Paths.get(nextItemPath)) - ); - nextItemId = nextItemPath.substring(nextItemPath.lastIndexOf(File.separatorChar) + 1); - Assert.assertTrue( - "File \"" + ITEM_INPUT_PATH + File.separatorChar + nextItemId + "\" doesn't exist", - Files.exists(Paths.get(ITEM_INPUT_PATH, nextItemId)) - ); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsMetricsThresholdTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsMetricsThresholdTest.java deleted file mode 100644 index aed9d6d5c4..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsMetricsThresholdTest.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.LogPatterns; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.util.Date; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.DateUtil.FMT_DATE_ISO8601; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by kurila on 01.02.17. - Covered use cases: - * 2.1.1.1.5. Very Big Data Items (100MB-10GB) - * 7.1. Metrics Periodic Reporting - * 7.3. Metrics Reporting Triggered by Load Threshold - * 8.2.1. Create New Items - * 9.2. Default Scenario - * 9.5.2. Load Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class CreateBigDataItemsMetricsThresholdTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("1GB"); - private static final int LOAD_CONCURRENCY = 100; - private static final double LOAD_THRESHOLD = 0.95; - private static final int LOAD_LIMIT_COUNT = LOAD_CONCURRENCY * STORAGE_DRIVERS_COUNT; - - private static String STD_OUTPUT = null; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CreateBigDataItemsMetricsThresholdTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - CONFIG_ARGS.add("--test-step-limit-count=" + LOAD_LIMIT_COUNT); - CONFIG_ARGS.add("--test-step-metrics-threshold=" + LOAD_THRESHOLD); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 10); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - LOAD_LIMIT_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - LOAD_LIMIT_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testMedTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsMedTotalLogRecords().get(0), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - 0, 0 - ); - } - - public void testFullThrottleConditionMessagesInStdout() - throws Exception { - Matcher m = LogPatterns.STD_OUT_LOAD_THRESHOLD_ENTRANCE.matcher(STD_OUTPUT); - assertTrue(m.find()); - final Date dtEnter = FMT_DATE_ISO8601.parse(m.group("dateTime")); - final int threshold = Integer.parseInt(m.group("threshold")); - assertEquals(LOAD_CONCURRENCY * LOAD_THRESHOLD, threshold, 0); - m = LogPatterns.STD_OUT_LOAD_THRESHOLD_EXIT.matcher(STD_OUTPUT); - assertTrue(m.find()); - final Date dtExit = FMT_DATE_ISO8601.parse(m.group("dateTime")); - assertTrue(dtEnter.before(dtExit)); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsTest.java deleted file mode 100644 index ab1dcd4e9c..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateBigDataItemsTest.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.PortListener; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.math3.stat.Frequency; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.nio.file.Files; -import java.nio.file.NoSuchFileException; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.model.storage.StorageDriver.BUFF_SIZE_MAX; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - Created by kurila on 27.01.17. - Covered use cases: - * 2.1.1.1.4. Big Data Items (100MB) - * 2.2.3.1. Random Item Ids - * 4.2. Small Concurrency Level (10) - * 6.1. Load Job Naming - * 6.2.2. Limit By Count - * 7.1. Periodic Reporting - * 7.4. I/O Traces Reporting - * 8.2.1. Create New Items - * 9.2. Default Scenario - * 10.1.4. Two Local Separate Storage Driver Services (at different ports) - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - */ - -public class CreateBigDataItemsTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("100MB"); - private static final String ITEM_OUTPUT_FILE = CreateBigDataItemsTest.class.getSimpleName() + ".csv"; - private static final int LOAD_LIMIT_COUNT = 1000; - private static final int LOAD_CONCURRENCY = 10; - private static String STD_OUTPUT = null; - - private static int ACTUAL_CONCURRENCY = 0; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CreateBigDataItemsTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final NoSuchFileException ignored) { - } - CONFIG_ARGS.add("--item-output-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.add("--test-step-limit-count=" + LOAD_LIMIT_COUNT); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.sleep(10); // warmup - final int startPort = CONFIG.getStorageConfig().getNetConfig().getNodeConfig().getPort(); - for(int i = 0; i < STORAGE_NODE_COUNT; i ++) { - ACTUAL_CONCURRENCY += PortListener - .getCountConnectionsOnPort("127.0.0.1:" + (startPort + i)); - } - TimeUnit.MINUTES.timedJoin(runner, 5); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - public void testActiveConnectionsCount() - throws Exception { - assertEquals(STORAGE_DRIVERS_COUNT * LOAD_CONCURRENCY, ACTUAL_CONCURRENCY); - } - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, - ITEM_DATA_SIZE, LOAD_LIMIT_COUNT, 0, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - LOAD_LIMIT_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final String nodeAddr = STORAGE_MOCKS.keySet().iterator().next(); - final List ioTraceRecords = getIoTraceLogRecords(); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), ITEM_DATA_SIZE); - testHttpStorageMockContains( - nodeAddr, ioTraceRecord.get("ItemPath"), - Long.parseLong(ioTraceRecord.get("TransferSize")) - ); - } - } - - public void testIoBufferSizeAdjustment() - throws Exception { - String msg = "Adjust output buffer size: " + SizeInBytes.formatFixedSize(BUFF_SIZE_MAX); - int k; - for(int i = 0; i < STORAGE_DRIVERS_COUNT; i ++) { - k = STD_OUTPUT.indexOf(msg); - if(k > -1) { - msg = STD_OUTPUT.substring(k + msg.length()); - } else { - fail("Expected the message to occur " + STORAGE_DRIVERS_COUNT + " times, but got " + i); - } - } - } - - public void testItemsOutputFile() - throws Exception { - final List items = new ArrayList<>(); - try(final BufferedReader br = new BufferedReader(new FileReader(ITEM_OUTPUT_FILE))) { - final CSVParser csvParser = CSVFormat.RFC4180.parse(br); - for(final CSVRecord csvRecord : csvParser) { - items.add(csvRecord); - } - } - final int itemIdRadix = CONFIG.getItemConfig().getNamingConfig().getRadix(); - final Frequency freq = new Frequency(); - assertEquals(LOAD_LIMIT_COUNT, items.size()); - String itemPath, itemId; - long itemOffset; - long itemSize; - String modLayerAndMask; - for(final CSVRecord itemRec : items) { - itemPath = itemRec.get(0); - itemId = itemPath.substring(itemPath.lastIndexOf('/') + 1); - itemOffset = Long.parseLong(itemRec.get(1), 0x10); - assertEquals(Long.parseLong(itemId, itemIdRadix), itemOffset); - freq.addValue(itemOffset); - itemSize = Long.parseLong(itemRec.get(2)); - assertEquals(ITEM_DATA_SIZE.get(), itemSize); - modLayerAndMask = itemRec.get(3); - assertEquals("0/0", modLayerAndMask); - } - assertEquals(items.size(), freq.getUniqueCount()); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByCountTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByCountTest.java deleted file mode 100644 index 48041dca43..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByCountTest.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.math3.stat.Frequency; -import org.apache.logging.log4j.Level; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.model.storage.StorageDriver.BUFF_SIZE_MIN; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -/** - Created by andrey on 19.01.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (1B-100KB) - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 4.2. Small Concurrency Level (2-10) - * 6.1. Test Step Naming - * 6.2.2. Limit Step by Processed Item Count - * 7.1. Metrics Periodic Reporting - * 7.4. I/O Traces Reporting - * 8.2.1. Create New Items - * 9.2. Default Scenario - * 10.1.4. Many Remote Storage Driver Services - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - */ - -public class CreateByCountTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("10B"); - private static final String ITEM_OUTPUT_FILE = CreateByCountTest.class.getSimpleName() + ".csv"; - private static final int LOAD_LIMIT_COUNT = 100; - private static final int LOAD_CONCURRENCY = 10; - - private static boolean FINISHED_IN_TIME = true; - private static String STD_OUTPUT = null; - - @BeforeClass public static void setUpClass() - throws Exception { - STEP_NAME = CreateByCountTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--item-output-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.add("--test-step-limit-count=" + LOAD_LIMIT_COUNT); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final IOException ignored) { - } - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - SCENARIO.run(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - STD_OUT_STREAM.startRecording(); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, 1000); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } - - @AfterClass public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - public void testFinishedInTime() - throws Exception { - assertTrue(FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, LOAD_LIMIT_COUNT, - 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, LOAD_LIMIT_COUNT, - 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final String nodeAddr = STORAGE_MOCKS.keySet().iterator().next(); - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals(LOAD_LIMIT_COUNT, ioTraceRecords.size()); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), ITEM_DATA_SIZE); - testHttpStorageMockContains( - nodeAddr, ioTraceRecord.get("ItemPath"), - Long.parseLong(ioTraceRecord.get("TransferSize")) - ); - } - } - - public void testIoBufferSizeAdjustment() - throws Exception { - String msg = "Adjust output buffer size: " + SizeInBytes.formatFixedSize(BUFF_SIZE_MIN); - int k; - for(int i = 0; i < STORAGE_DRIVERS_COUNT; i ++) { - k = STD_OUTPUT.indexOf(msg); - if(k > -1) { - msg = STD_OUTPUT.substring(k + msg.length()); - } else { - fail("Expected the message to occur " + STORAGE_DRIVERS_COUNT + " times, but got " + i); - } - } - } - - public void testItemsOutputFile() - throws Exception { - final List items = new ArrayList<>(); - try(final BufferedReader br = new BufferedReader(new FileReader(ITEM_OUTPUT_FILE))) { - final CSVParser csvParser = CSVFormat.RFC4180.parse(br); - for(final CSVRecord csvRecord : csvParser) { - items.add(csvRecord); - } - } - assertEquals(LOAD_LIMIT_COUNT, items.size()); - final int itemIdRadix = CONFIG.getItemConfig().getNamingConfig().getRadix(); - final Frequency freq = new Frequency(); - String itemPath, itemId; - long itemOffset; - long itemSize; - String modLayerAndMask; - for(final CSVRecord itemRec : items) { - itemPath = itemRec.get(0); - itemId = itemPath.substring(itemPath.lastIndexOf('/') + 1); - itemOffset = Long.parseLong(itemRec.get(1), 0x10); - assertEquals(Long.parseLong(itemId, itemIdRadix), itemOffset); - freq.addValue(itemOffset); - itemSize = Long.parseLong(itemRec.get(2)); - assertEquals(ITEM_DATA_SIZE.get(), itemSize); - modLayerAndMask = itemRec.get(3); - assertEquals("0/0", modLayerAndMask); - } - assertEquals(items.size(), freq.getUniqueCount()); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByTimeTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByTimeTest.java deleted file mode 100644 index 378d3011c8..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateByTimeTest.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.math3.stat.Frequency; -import org.apache.logging.log4j.Level; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -/** - Created by andrey on 19.01.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (10KB) - * 2.2.3.1. Random Item Ids - * 2.3.2. CSV File - * 4.3. Medium Concurrency Level (100) - * 6.1. Load Job Naming - * 6.2.5. By Time - * 7.1. Periodic Reporting - * 7.4. I/O Traces Reporting - * 8.2.1. Create New Items - * 9.2. Default Scenario - * 10.1.4. Two Local Separate Storage Driver Services (at different ports) - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - */ - -public class CreateByTimeTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("10KB"); - private static final String ITEM_OUTPUT_FILE = CreateByTimeTest.class.getSimpleName() + ".csv"; - private static final int LOAD_LIMIT_TIME = 25; - private static final int LOAD_CONCURRENCY = 100; - - private static boolean FINISHED_IN_TIME = true; - private static String STD_OUTPUT = null; - - @BeforeClass public static void setUpClass() - throws Exception { - STEP_NAME = CreateByTimeTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--item-output-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.add("--test-step-limit-time=" + LOAD_LIMIT_TIME); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final IOException ignored) { - } - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, LOAD_LIMIT_TIME + 5); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - public void testFinishedInTime() - throws Exception { - assertTrue(FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, 0, - LOAD_LIMIT_TIME, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, 0, - LOAD_LIMIT_TIME - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final String nodeAddr = STORAGE_MOCKS.keySet().iterator().next(); - final List ioTraceRecords = getIoTraceLogRecords(); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), ITEM_DATA_SIZE); - testHttpStorageMockContains( - nodeAddr, ioTraceRecord.get("ItemPath"), - Long.parseLong(ioTraceRecord.get("TransferSize")) - ); - } - } - - public void testIoBufferSizeAdjustment() - throws Exception { - String msg = "Adjust output buffer size: " + ITEM_DATA_SIZE; - int k; - for(int i = 0; i < STORAGE_DRIVERS_COUNT; i ++) { - k = STD_OUTPUT.indexOf(msg); - if(k > -1) { - msg = STD_OUTPUT.substring(k + msg.length()); - } else { - fail("Expected the message to occur " + STORAGE_DRIVERS_COUNT + " times, but got " + i); - } - } - } - - public void testItemsOutputFile() - throws Exception { - final List items = new ArrayList<>(); - try(final BufferedReader br = new BufferedReader(new FileReader(ITEM_OUTPUT_FILE))) { - final CSVParser csvParser = CSVFormat.RFC4180.parse(br); - for(final CSVRecord csvRecord : csvParser) { - items.add(csvRecord); - } - } - final int itemIdRadix = CONFIG.getItemConfig().getNamingConfig().getRadix(); - final Frequency freq = new Frequency(); - String itemPath, itemId; - long itemOffset; - long itemSize; - String modLayerAndMask; - for(final CSVRecord itemRec : items) { - itemPath = itemRec.get(0); - itemId = itemPath.substring(itemPath.lastIndexOf('/') + 1); - itemOffset = Long.parseLong(itemRec.get(1), 0x10); - assertEquals(Long.parseLong(itemId, itemIdRadix), itemOffset); - freq.addValue(itemOffset); - itemSize = Long.parseLong(itemRec.get(2)); - assertEquals(ITEM_DATA_SIZE.get(), itemSize); - modLayerAndMask = itemRec.get(3); - assertEquals("0/0", modLayerAndMask); - } - assertEquals(items.size(), freq.getUniqueCount()); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateNoLimitHighConcurrencyTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateNoLimitHighConcurrencyTest.java deleted file mode 100644 index 88deeaa1b5..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/CreateNoLimitHighConcurrencyTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.PortListener; -import com.emc.mongoose.ui.log.LogUtil; -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; - -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import static org.junit.Assert.assertEquals; -import java.util.concurrent.TimeUnit; - -/** - Created by kurila on 31.01.17. - Covered use cases: - * 2.1.1.1.3. Default Data Items (1MB) - * 4.4. High Concurrency Level (1K) - * 6.2.1. Load Jobs Are Infinite by Default - * 9.2. Default Scenario - * 9.5.2. Load Job - * 10.4.4. Two Local Separate Storage Driver Services (at different ports) - */ - -public class CreateNoLimitHighConcurrencyTest -extends HttpStorageDistributedScenarioTestBase { - - private static final int LOAD_CONCURRENCY = 1000; - - private static Thread RUNNER; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = CreateNoLimitHighConcurrencyTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - HttpStorageDistributedScenarioTestBase.setUpClass(); - RUNNER = new Thread( - () -> { - try { - SCENARIO.run(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - RUNNER.start(); - } - - - public final void testActiveConnectionsCount() - throws Exception { - final int startPort = CONFIG.getStorageConfig().getNetConfig().getNodeConfig().getPort(); - int activeConnCount; - TimeUnit.SECONDS.sleep(30); - activeConnCount = 0; - for(int j = 0; j < STORAGE_NODE_COUNT; j ++) { - activeConnCount += PortListener - .getCountConnectionsOnPort("127.0.0.1:" + (startPort + j)); - } - assertEquals( - STORAGE_DRIVERS_COUNT * LOAD_CONCURRENCY, activeConnCount, - STORAGE_DRIVERS_COUNT * LOAD_CONCURRENCY / 1000 - ); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - RUNNER.interrupt(); - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/MixedLoadTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/MixedLoadTest.java deleted file mode 100644 index 7ea2bf137e..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/MixedLoadTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.PortListener; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by kurila on 23.03.17. - Covered Use Cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.3. Medium Concurrency Level (11-100) - * 5. Circularity - * 6.2.5. Limit Load Job by Time - * 7.1. Metrics Periodic Reporting - * 8.2.1. Create New Items - * 8.3.1. Read With Disabled Validation - * 9.1. Scenarios Syntax - * 9.4.1. Override Default Configuration in the Scenario - * 9.4.3. Reusing The Items in the Scenario - * 9.5.3. Precondition Load Job - * 9.5.7.1. Separate Configuration in the Mixed Load Job - * 10.1.2. Many Local Separate Storage Driver Services (at different ports) - */ - -public class MixedLoadTest -extends HttpStorageDistributedScenarioTestBase { - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "mixed", "mixed.json" - ); - private static final int EXPECTED_CONCURRENCY = 20 + 50; - - private static boolean FINISHED_IN_TIME; - private static String STD_OUTPUT; - private static int ACTUAL_CONCURRENCY; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = MixedLoadTest.class.getSimpleName(); - try { - Files.delete(Paths.get("items2read.csv")); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - SCENARIO.run(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.sleep(10); - STD_OUT_STREAM.startRecording(); - TimeUnit.SECONDS.sleep(10); - final int startPort = CONFIG.getStorageConfig().getNetConfig().getNodeConfig().getPort(); - for(int i = 0; i < STORAGE_NODE_COUNT; i ++) { - ACTUAL_CONCURRENCY += PortListener - .getCountConnectionsOnPort("127.0.0.1:" + (startPort + i)); - } - TimeUnit.SECONDS.timedJoin(runner, 50); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - - public void testActualConcurrency() { - assertEquals(STORAGE_DRIVERS_COUNT * EXPECTED_CONCURRENCY, ACTUAL_CONCURRENCY, 5); - } - - - public void testMetricsStdout() - throws Exception { - final Map concurrencyMap = new HashMap<>(); - concurrencyMap.put(IoType.CREATE, 20); - concurrencyMap.put(IoType.READ, 50); - testMetricsTableStdout(STD_OUTPUT, STEP_NAME, STORAGE_DRIVERS_COUNT, 0, concurrencyMap); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBigDataItemsTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBigDataItemsTest.java deleted file mode 100644 index 9d0b8270d4..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBigDataItemsTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.common.env.PathUtil; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.run.scenario.JsonScenario; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.PortListener; -import com.emc.mongoose.ui.cli.CliArgParser; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.NoSuchFileException; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.model.storage.StorageDriver.BUFF_SIZE_MAX; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - Created by kurila on 30.01.17. - Covered use cases: - * 2.1.1.1.4. Big Data Items (100MB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 4.2. Small Concurrency Level (10) - * 6.1. Load Job Naming - * 6.2.4. Limit By Size - * 6.2.6. Limit By End of Items Input - * 7.1. Periodic Reporting - * 7.4. I/O Traces Reporting - * 8.3.2. Read - Enabled Validation - * 9.2. Default Scenario - * 10.1.4. Two Local Separate Storage Driver Services (at different ports) - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - */ - -public class ReadBigDataItemsTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("100MB"); - private static final String ITEM_OUTPUT_FILE = ReadBigDataItemsTest.class.getSimpleName() + ".csv"; - private static final int LOAD_CONCURRENCY = 10; - private static final SizeInBytes LOAD_LIMIT_SIZE = new SizeInBytes("100GB"); - private static final long EXPECTED_COUNT = LOAD_LIMIT_SIZE.get() / ITEM_DATA_SIZE.get(); - - private static String STD_OUTPUT = null; - private static int ACTUAL_CONCURRENCY = 0; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadBigDataItemsTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final NoSuchFileException ignored) { - } - CONFIG_ARGS.add("--item-output-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.add("--test-step-limit-size=" + LOAD_LIMIT_SIZE.toString()); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - HttpStorageDistributedScenarioTestBase.setUpClass(); - SCENARIO.run(); - - // reinit - SCENARIO.close(); - STEP_NAME = ReadBigDataItemsTest.class.getSimpleName() + "_"; - FileUtils.deleteDirectory(Paths.get(PathUtil.getBaseDir(), "log", STEP_NAME).toFile()); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - LogUtil.init(); - CONFIG_ARGS.add("--item-data-verify"); - CONFIG_ARGS.add("--item-input-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.add("--load-type=read"); - CONFIG.apply( - CliArgParser.parseArgs( - CONFIG.getAliasingConfig(), CONFIG_ARGS.toArray(new String[CONFIG_ARGS.size()]) - ) - ); - CONFIG.getItemConfig().getOutputConfig().setFile(null); - CONFIG.getTestConfig().getStepConfig().getLimitConfig().setCount(0); - CONFIG.getTestConfig().getStepConfig().setName(STEP_NAME); - SCENARIO = new JsonScenario(CONFIG, DEFAULT_SCENARIO_PATH.toFile()); - - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.sleep(10); // warmup - final int startPort = CONFIG.getStorageConfig().getNetConfig().getNodeConfig().getPort(); - for(int i = 0; i < STORAGE_NODE_COUNT; i ++) { - ACTUAL_CONCURRENCY += PortListener - .getCountConnectionsOnPort("127.0.0.1:" + (startPort + i)); - } - TimeUnit.MINUTES.timedJoin(runner, 5); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testActiveConnectionsCount() - throws Exception { - assertEquals(STORAGE_DRIVERS_COUNT * LOAD_CONCURRENCY, ACTUAL_CONCURRENCY); - } - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, EXPECTED_COUNT, 0, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals(EXPECTED_COUNT, ioTraceRecords.size(), EXPECTED_COUNT / 5); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), ITEM_DATA_SIZE); - } - } - - public void testIoBufferSizeAdjustment() - throws Exception { - String msg = "Adjust input buffer size: " + SizeInBytes.formatFixedSize(BUFF_SIZE_MAX); - int k; - for(int i = 0; i < STORAGE_DRIVERS_COUNT; i ++) { - k = STD_OUTPUT.indexOf(msg); - if(k > -1) { - msg = STD_OUTPUT.substring(k + msg.length()); - } else { - fail("Expected the message to occur " + STORAGE_DRIVERS_COUNT + " times, but got " + i); - } - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBucketListingTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBucketListingTest.java deleted file mode 100644 index 3435fb51f5..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadBucketListingTest.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.common.env.PathUtil; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.run.scenario.JsonScenario; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.PortListener; -import com.emc.mongoose.ui.cli.CliArgParser; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - Created by kurila on 30.01.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (10KB) - * 2.2.2. Path Listing - * 2.3.3.1. Constant Destination Path - * 4.4. Big Concurrency Level (1K) - * 8.3.2. Read - Enabled Validation - * 9.2. Default Scenario - * 9.5.2. Load Job - * 10.1.4. Two Local Separate Storage Driver Services (at different ports) - * 10.2.2. Destination Path Precondition Hook - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - */ - -public class ReadBucketListingTest -extends HttpStorageDistributedScenarioTestBase { - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("10KB"); - private static final String ITEM_OUTPUT_PATH = ReadBucketListingTest.class.getSimpleName(); - private static final int LOAD_CONCURRENCY = 10; - private static final int LOAD_LIMIT_TIME = 50; - - private static String STD_OUTPUT = null; - private static int ACTUAL_CONCURRENCY = 0; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadBucketListingTest.class.getSimpleName(); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--item-output-path=" + ITEM_OUTPUT_PATH); - CONFIG_ARGS.add("--storage-driver-concurrency=100"); - CONFIG_ARGS.add("--test-step-limit-time=" + LOAD_LIMIT_TIME); - CONFIG_ARGS.add("--test-step-name=" + STEP_NAME); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - HttpStorageDistributedScenarioTestBase.setUpClass(); - SCENARIO.run(); - - // reinit - SCENARIO.close(); - STEP_NAME = ReadBucketListingTest.class.getSimpleName() + "_"; - FileUtils.deleteDirectory(Paths.get(PathUtil.getBaseDir(), "log", STEP_NAME).toFile()); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - LogUtil.init(); - CONFIG_ARGS.add("--item-data-verify"); - CONFIG_ARGS.add("--item-input-path=" + ITEM_OUTPUT_PATH); - CONFIG_ARGS.add("--load-type=read"); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - CONFIG_ARGS.add("--test-step-name=" + STEP_NAME); - CONFIG.apply( - CliArgParser.parseArgs( - CONFIG.getAliasingConfig(), CONFIG_ARGS.toArray(new String[CONFIG_ARGS.size()]) - ) - ); - CONFIG.getItemConfig().getOutputConfig().setPath(null); - CONFIG.getTestConfig().getStepConfig().getLimitConfig().setTime(0); - CONFIG.getTestConfig().getStepConfig().setName(STEP_NAME); - SCENARIO = new JsonScenario(CONFIG, DEFAULT_SCENARIO_PATH.toFile()); - - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.sleep(10); // warmup - final int startPort = CONFIG.getStorageConfig().getNetConfig().getNodeConfig().getPort(); - for(int i = 0; i < STORAGE_NODE_COUNT; i ++) { - ACTUAL_CONCURRENCY += PortListener - .getCountConnectionsOnPort("127.0.0.1:" + (startPort + i)); - } - TimeUnit.MINUTES.timedJoin(runner, 5); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testActiveConnectionsCount() - throws Exception { - assertEquals(STORAGE_DRIVERS_COUNT * LOAD_CONCURRENCY, ACTUAL_CONCURRENCY); - } - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, 0, 0, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, 0, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), ITEM_DATA_SIZE); - } - } - - public void testIoBufferSizeAdjustment() - throws Exception { - String msg = "Adjust input buffer size: " + ITEM_DATA_SIZE.toString(); - int k; - for(int i = 0; i < STORAGE_DRIVERS_COUNT; i ++) { - k = STD_OUTPUT.indexOf(msg); - if(k > -1) { - msg = STD_OUTPUT.substring(k + msg.length()); - } else { - fail("Expected the message to occur " + STORAGE_DRIVERS_COUNT + " times, but got " + i); - } - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadCircularUpdatedTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadCircularUpdatedTest.java deleted file mode 100644 index 18e01b673d..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadCircularUpdatedTest.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.codec.binary.Hex; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.math3.stat.Frequency; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 06.02.17. - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 4.2. Small Concurrency Level (2-10) - * 5. Circularity - * 6.2.2. Limit Load Job by Processed Item Count - * 6.2.5. Limit Load Job by Time - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.4.2.1. Single Random Range Update - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class ReadCircularUpdatedTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "circular", "read-updated.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("1MB"); - private static final int EXPECTED_CONCURRENCY = 10; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE_0 = "circular-read-updated-0.csv"; - private static final String ITEM_OUTPUT_FILE_1 = "circular-read-updated-1.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadCircularUpdatedTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_0)); - Files.delete(Paths.get(ITEM_OUTPUT_FILE_1)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 90); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } - - public void testUpdatedItemsOutputFile() - throws Exception { - final List items = new ArrayList<>(); - try(final BufferedReader br = new BufferedReader(new FileReader(ITEM_OUTPUT_FILE_1))) { - final CSVParser csvParser = CSVFormat.RFC4180.parse(br); - for(final CSVRecord csvRecord : csvParser) { - items.add(csvRecord); - } - } - final int itemIdRadix = CONFIG.getItemConfig().getNamingConfig().getRadix(); - final Frequency freq = new Frequency(); - String itemPath, itemId; - long itemOffset; - long itemSize; - String modLayerAndMask[]; - String rangesMask; - char rangesMaskChars[]; - int layer; - BitSet mask; - for(final CSVRecord itemRec : items) { - itemPath = itemRec.get(0); - itemId = itemPath.substring(itemPath.lastIndexOf('/') + 1); - itemOffset = Long.parseLong(itemRec.get(1), 0x10); - assertEquals(Long.parseLong(itemId, itemIdRadix), itemOffset); - freq.addValue(itemOffset); - itemSize = Long.parseLong(itemRec.get(2)); - assertEquals(EXPECTED_ITEM_DATA_SIZE.get(), itemSize); - modLayerAndMask = itemRec.get(3).split("/"); - assertEquals("Modification record should contain 2 parts", 2, modLayerAndMask.length); - layer = Integer.parseInt(modLayerAndMask[0], 0x10); - rangesMask = modLayerAndMask[1]; - if(rangesMask.length() == 0) { - rangesMaskChars = ("00" + rangesMask).toCharArray(); - } else if(rangesMask.length() % 2 == 1) { - rangesMaskChars = ("0" + rangesMask).toCharArray(); - } else { - rangesMaskChars = rangesMask.toCharArray(); - } - mask = BitSet.valueOf(Hex.decodeHex(rangesMaskChars)); - if(layer == 0) { - assertTrue( - "The modification record \"" + itemRec.get(3) + "\" is not updated", - mask.cardinality() > 0 - ); - } - } - assertEquals(items.size(), freq.getUniqueCount()); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedFileRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedFileRangesTest.java deleted file mode 100644 index 6c8524e082..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedFileRangesTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.FileStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.2.4. Read Multiple Fixed Ranges - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - * 10.3. Filesystem Storage Driver - */ - -public class ReadMultipleFixedFileRangesTest -extends FileStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-multiple-fixed-ranges.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes( - (456 - 123) + (1011 - 789) + (151617 - 121314) + (212223 - 181920) + (256 * 1024 - 242526) - ); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE = "read-multiple-fixed-ranges.csv"; - private static final String ITEM_OUTPUT_PATH = "/tmp/read-multiple-fixed-ranges"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadMultipleFixedFileRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - FileUtils.deleteDirectory(new File(ITEM_OUTPUT_PATH)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-output-path=" + ITEM_OUTPUT_PATH); - CONFIG_ARGS.add("--item-data-verify=true"); - FileStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 1); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - FileStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedRangesTest.java deleted file mode 100644 index 23abde3258..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleFixedRangesTest.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.2.4. Read Multiple Fixed Ranges - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class ReadMultipleFixedRangesTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-multiple-fixed-ranges.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes( - (456 - 123) + (1011 - 789) + (151617 - 121314) + (212223 - 181920) + (256 * 1024 - 242526) - ); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE = "read-multiple-fixed-ranges.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadMultipleFixedRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-data-verify=true"); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 20000); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomFileRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomFileRangesTest.java deleted file mode 100644 index 7ce831a9a4..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomFileRangesTest.java +++ /dev/null @@ -1,159 +0,0 @@ - -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.FileStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (1KB-100KB) - * 2.2.1. Items Input File - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.1.2. Multiple Random Byte Ranges Read - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - * 10.3. Filesystem Storage Driver - */ - -public class ReadMultipleRandomFileRangesTest -extends FileStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-multiple-random-ranges.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("1-1KB"); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE = "read-multiple-random-ranges.csv"; - private static final String ITEM_OUTPUT_PATH = "/tmp/read-multiple-random-ranges"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadMultipleRandomFileRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - FileUtils.deleteDirectory(new File(ITEM_OUTPUT_PATH)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-output-path=" + ITEM_OUTPUT_PATH); - CONFIG_ARGS.add("--item-data-verify=true"); - FileStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 1); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - FileStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomRangesTest.java deleted file mode 100644 index b8ee09c938..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadMultipleRandomRangesTest.java +++ /dev/null @@ -1,151 +0,0 @@ - -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (1KB-100KB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.1.2. Multiple Random Byte Ranges Read - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class ReadMultipleRandomRangesTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-multiple-random-ranges.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("1-1KB"); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE = "read-multiple-random-ranges.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadMultipleRandomRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-data-verify=true"); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 1); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(20); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleFixedRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleFixedRangesTest.java deleted file mode 100644 index d1de2d9135..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleFixedRangesTest.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.2.3. Read Bytes from N1 to N2 - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class ReadSingleFixedRangesTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-fixed-ranges.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("1MB"); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 100; - private static final String ITEM_OUTPUT_FILE = "read-fixed-ranges.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadSingleFixedRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-data-verify=true"); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 1); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(20); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleRandomFileRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleRandomFileRangesTest.java deleted file mode 100644 index bffd48db34..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSingleRandomFileRangesTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.FileStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; - -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; - -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (1KB-100KB) - * 2.2.1. Items Input File - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.1.1. Single Random Byte Range Read - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - * 10.3. Filesystem Storage Driver - */ - -public class ReadSingleRandomFileRangesTest -extends FileStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-random-ranges.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("1-1KB"); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE = "read-random-ranges.csv"; - private static final String ITEM_OUTPUT_PATH = "/tmp/read-random-ranges"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadSingleRandomFileRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - FileUtils.deleteDirectory(new File(ITEM_OUTPUT_PATH)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-output-path=" + ITEM_OUTPUT_PATH); - CONFIG_ARGS.add("--item-data-verify=true"); - FileStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 1); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(20); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - FileStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSmallDataItemsMetricsThresholdTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSmallDataItemsMetricsThresholdTest.java deleted file mode 100644 index 88167bec7f..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadSmallDataItemsMetricsThresholdTest.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.common.env.PathUtil; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.run.scenario.JsonScenario; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.LogPatterns; -import com.emc.mongoose.ui.cli.CliArgParser; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Date; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.DateUtil.FMT_DATE_ISO8601; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by kurila on 01.02.17. - * 1.2. CLI Arguments Aliasing - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 7.1. Metrics Periodic Reporting - * 7.3. Metrics Reporting Triggered by Load Threshold - * 8.2.1. Create New Items - * 8.3.1. Read With Disabled Validation - * 9.2. Default Scenario - * 9.5.2. Load Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class ReadSmallDataItemsMetricsThresholdTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("1KB"); - private static final String ITEM_OUTPUT_FILE = - ReadSmallDataItemsMetricsThresholdTest.class.getSimpleName() + ".csv"; - private static final int LOAD_LIMIT_COUNT = 1_000_000; - private static final int LOAD_CONCURRENCY = 500; - private static final double LOAD_THRESHOLD = 0.6; - - private static String STD_OUTPUT = null; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadSmallDataItemsMetricsThresholdTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE)); - } catch(final Exception ignored) { - } - CONFIG_ARGS.add("--item-output-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - CONFIG_ARGS.add("--test-step-limit-count=" + LOAD_LIMIT_COUNT); - - HttpStorageDistributedScenarioTestBase.setUpClass(); - SCENARIO.run(); - - // reinit for read - SCENARIO.close(); - STEP_NAME = ReadSmallDataItemsMetricsThresholdTest.class.getSimpleName() + "_"; - FileUtils.deleteDirectory(Paths.get(PathUtil.getBaseDir(), "log", STEP_NAME).toFile()); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - LogUtil.init(); - CONFIG_ARGS.remove("--item-data-size=" + ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--item-input-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.remove("--item-output-file=" + ITEM_OUTPUT_FILE); - CONFIG_ARGS.remove("--test-step-limit-count=" + LOAD_LIMIT_COUNT); - CONFIG_ARGS.add("--read"); - CONFIG_ARGS.add("--test-step-metrics-threshold=" + LOAD_THRESHOLD); - CONFIG.apply( - CliArgParser.parseArgs( - CONFIG.getAliasingConfig(), CONFIG_ARGS.toArray(new String[CONFIG_ARGS.size()]) - ) - ); - CONFIG.getItemConfig().getOutputConfig().setFile(null); - CONFIG.getTestConfig().getStepConfig().getLimitConfig().setCount(0); - CONFIG.getTestConfig().getStepConfig().setName(STEP_NAME); - SCENARIO = new JsonScenario(CONFIG, DEFAULT_SCENARIO_PATH.toFile()); - - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 10); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(20); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - LOAD_LIMIT_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - LOAD_LIMIT_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testMedTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsMedTotalLogRecords().get(0), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - 0, 0 - ); - } - - public void testFullThrottleConditionMessagesInStdout() - throws Exception { - Matcher m = LogPatterns.STD_OUT_LOAD_THRESHOLD_ENTRANCE.matcher(STD_OUTPUT); - assertTrue(m.find()); - final Date dtEnter = FMT_DATE_ISO8601.parse(m.group("dateTime")); - final int threshold = Integer.parseInt(m.group("threshold")); - assertEquals(LOAD_CONCURRENCY * LOAD_THRESHOLD, threshold, 0); - m = LogPatterns.STD_OUT_LOAD_THRESHOLD_EXIT.matcher(STD_OUTPUT); - assertTrue(m.find()); - final Date dtExit = FMT_DATE_ISO8601.parse(m.group("dateTime")); - assertTrue(dtEnter + " should be before " + dtExit, dtEnter.before(dtExit)); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleFixedRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleFixedRangesTest.java deleted file mode 100644 index ab084cef17..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleFixedRangesTest.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.2.4. Read Multiple Fixed Ranges - * 8.4.2.2. Multiple Random Ranges Update - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.1. Single Local Separate Storage Driver Service - */ - -public class ReadUpdatedMultipleFixedRangesTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-multiple-fixed-ranges-updated.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes( - (0 - 0 + 1) + (34 - 12 + 1) + (78 - 56 + 1) + (1024 - 910 + 1) - ); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE_0 = "read-multiple-fixed-ranges-0.csv"; - private static final String ITEM_OUTPUT_FILE_1 = "read-multiple-fixed-ranges-1.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadUpdatedMultipleFixedRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_1)); - } catch(final Exception ignored) { - } - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_0)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-data-verify=true"); - STORAGE_DRIVERS_COUNT = 1; - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 2); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - STORAGE_DRIVERS_COUNT = 2; // to default - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleRandomRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleRandomRangesTest.java deleted file mode 100644 index 0b735c32f9..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadUpdatedMultipleRandomRangesTest.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.2.4. Read Multiple Fixed Ranges - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class ReadUpdatedMultipleRandomRangesTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-multiple-random-ranges-updated.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("1-1KB"); - private static final int EXPECTED_CONCURRENCY = 1; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE_0 = "read-multiple-random-ranges-0.csv"; - private static final String ITEM_OUTPUT_FILE_1 = "read-multiple-random-ranges-1.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = ReadUpdatedMultipleRandomRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_1)); - } catch(final Exception ignored) { - } - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_0)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - CONFIG_ARGS.add("--item-data-verify=true"); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 2); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadVerificationFailTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadVerificationFailTest.java deleted file mode 100644 index c90b17f97a..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/ReadVerificationFailTest.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.common.env.PathUtil; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.model.io.task.IoTask; -import static com.emc.mongoose.model.io.task.IoTask.Status; -import com.emc.mongoose.run.scenario.JsonScenario; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.cli.CliArgParser; -import com.emc.mongoose.ui.config.reader.jackson.ConfigParser; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.CloseableThreadContext; - -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static org.junit.Assert.assertEquals; - -/** - Created by kurila on 30.05.17. - * 1.1. Configuration Syntax - * 1.2. CLI Arguments Aliasing - * 2.1.1.1.2. Small Data Items (1B-100KB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 3.2. Payload From the External File - * 4.3. Medium Concurrency Level (11-100) - * 6.2.2. Limit Step by Processed Item Count - * 6.2.6. Limit Step by End of Items Input - * 7.4. I/O Traces Reporting - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.4.2.1. Single Random Range Update - * 9.2. Default Scenario - * 10.1.2. Many Local Separate Storage Driver Services (at different ports) - */ - -public final class ReadVerificationFailTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("10KB"); - private static final int EXPECTED_CONCURRENCY = 25; - private static final long EXPECTED_COUNT = 100000; - private static final String ITEM_OUTPUT_FILE_0 = ReadVerificationFailTest.class.getSimpleName() + - "0.csv"; - private static final String ITEM_OUTPUT_FILE_1 = ReadVerificationFailTest.class.getSimpleName() + - "1.csv"; - - @BeforeClass - public static void setUpClass() - throws Exception { - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_0)); - } catch(final IOException ignored) { - } - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_1)); - } catch(final IOException ignored) { - } - - STEP_NAME = ReadVerificationFailTest.class.getSimpleName() + "0"; - try( - final CloseableThreadContext.Instance logCtx = CloseableThreadContext - .put(KEY_STEP_NAME, STEP_NAME) - ) { - FileUtils.deleteDirectory(Paths.get(PathUtil.getBaseDir(), "log", STEP_NAME).toFile()); - CONFIG_ARGS.add("--item-data-content-file=" + PathUtil.getBaseDir() + "/config/content/zerobytes"); - CONFIG_ARGS.add("--item-data-size=" + EXPECTED_ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--item-output-file=" + ITEM_OUTPUT_FILE_0); - CONFIG_ARGS.add("--storage-driver-concurrency=" + EXPECTED_CONCURRENCY); - CONFIG_ARGS.add("--test-step-limit-count=" + EXPECTED_COUNT); - HttpStorageDistributedScenarioTestBase.setUpClass(); - SCENARIO.run(); - } - - STEP_NAME = ReadVerificationFailTest.class.getSimpleName() + "1"; - try( - final CloseableThreadContext.Instance logCtx = CloseableThreadContext - .put(KEY_STEP_NAME, STEP_NAME) - ) { - FileUtils.deleteDirectory(Paths.get(PathUtil.getBaseDir(), "log", STEP_NAME).toFile()); - CONFIG_ARGS.clear(); - CONFIG_ARGS.add("--update"); - CONFIG_ARGS.add("--item-data-content-file=" + PathUtil.getBaseDir() + "/config/content/zerobytes"); - CONFIG_ARGS.add("--item-data-ranges-random=3"); - CONFIG_ARGS.add("--item-input-file=" + ITEM_OUTPUT_FILE_0); - CONFIG_ARGS.add("--item-output-file=" + ITEM_OUTPUT_FILE_1); - CONFIG_ARGS.add("--storage-driver-concurrency=" + EXPECTED_CONCURRENCY); - CONFIG = ConfigParser.loadDefaultConfig(); - CONFIG.apply( - CliArgParser.parseArgs( - CONFIG.getAliasingConfig(), CONFIG_ARGS.toArray(new String[CONFIG_ARGS.size()]) - ) - ); - CONFIG.getTestConfig().getStepConfig().setName(STEP_NAME); - CONFIG.getTestConfig().getStepConfig().getLimitConfig().setCount(0); - SCENARIO = new JsonScenario(CONFIG, SCENARIO_PATH.toFile()); - SCENARIO.run(); - } - - STEP_NAME = ReadVerificationFailTest.class.getSimpleName() + "2"; - try( - final CloseableThreadContext.Instance logCtx = CloseableThreadContext - .put(KEY_STEP_NAME, STEP_NAME) - ) { - FileUtils.deleteDirectory(Paths.get(PathUtil.getBaseDir(), "log", STEP_NAME).toFile()); - CONFIG_ARGS.clear(); - CONFIG_ARGS.add("--read"); - CONFIG_ARGS.add("--item-data-content-file=" + PathUtil.getBaseDir() + "/config/content/zerobytes"); - CONFIG_ARGS.add("--item-data-verify=" + Boolean.TRUE.toString()); - CONFIG_ARGS.add("--item-input-file=" + ITEM_OUTPUT_FILE_0); - CONFIG_ARGS.add("--storage-driver-concurrency=" + EXPECTED_CONCURRENCY); - CONFIG = ConfigParser.loadDefaultConfig(); - CONFIG.apply( - CliArgParser.parseArgs( - CONFIG.getAliasingConfig(), CONFIG_ARGS.toArray(new String[CONFIG_ARGS.size()]) - ) - ); - CONFIG.getTestConfig().getStepConfig().setName(STEP_NAME); - SCENARIO = new JsonScenario(CONFIG, SCENARIO_PATH.toFile()); - SCENARIO.run(); - } - LoadJobLogFileManager.flush(STEP_NAME); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file, but got: " + - ioTraceRecords.size(), - EXPECTED_COUNT, ioTraceRecords.size() - ); - CSVRecord csvRecord; - for(int i = 0; i < ioTraceRecords.size(); i ++) { - csvRecord = ioTraceRecords.get(i); - assertEquals( - "Record #" + i + ": unexpected operation type " + csvRecord.get("IoTypeCode"), - IoType.READ, - IoType.values()[Integer.parseInt(csvRecord.get("IoTypeCode"))] - ); - assertEquals( - "Record #" + i + ": unexpected status code " + csvRecord.get("StatusCode"), - Status.RESP_FAIL_CORRUPT, - IoTask.Status.values()[Integer.parseInt(csvRecord.get("StatusCode"))] - ); - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/S3MpuTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/S3MpuTest.java deleted file mode 100644 index 3d906ab9b4..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/S3MpuTest.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 05.03.17. - Covered use cases: - * 2.1.1.1.5. Very Big Data Items (100MB-10GB) - * 4.2. Small Concurrency Level (2-10) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 7.1. Metrics Periodic Reporting - * 8.2.1. Create New Items - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.5.2. Load Job - * 10.1.2. Many Local Separate Storage Driver Services (at different ports) - * 10.2.2. Destination Path Precondition Hook - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - * 10.4.5.3.4. Multipart Upload - */ - -public class S3MpuTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "s3", "mpu.json" - ); - private static final int EXPECTED_CONCURRENCY = 10; - private static final long EXPECTED_COUNT = 10; - private static final SizeInBytes EXPECTED_SIZE = new SizeInBytes("10GB"); - private static final SizeInBytes EXPECTED_PART_SIZE = new SizeInBytes("1GB"); - - private static boolean FINISHED_IN_TIME; - private static String STD_OUTPUT; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = S3MpuTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, 300); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.CREATE, EXPECTED_CONCURRENCY, - STORAGE_DRIVERS_COUNT, EXPECTED_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertTrue( - "There should be more than " + EXPECTED_COUNT + - " records in the I/O trace log file, but got: " + ioTraceRecords.size(), - EXPECTED_COUNT < ioTraceRecords.size() - ); - final SizeInBytes ZERO_SIZE = new SizeInBytes(0); - final SizeInBytes TAIL_PART_SIZE = new SizeInBytes( - EXPECTED_SIZE.get() % EXPECTED_PART_SIZE.get() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - try { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), ZERO_SIZE); - } catch(final AssertionError e) { - try { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), EXPECTED_PART_SIZE); - } catch(final AssertionError ee) { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), TAIL_PART_SIZE); - } - } - } - } - - - public void testUploadLogRecords() - throws Exception { - final List uploadRecs = getPartsUploadRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + - " records in the uploads log file, but got: " + uploadRecs.size(), - EXPECTED_COUNT, uploadRecs.size() - ); - testPartsUploadRecord(uploadRecs); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftCreateDloTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftCreateDloTest.java deleted file mode 100644 index 25a6cd9316..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftCreateDloTest.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 05.03.17. - Covered use cases: - * 2.1.1.1.5. Very Big Data Items (100MB-10GB) - * 4.2. Small Concurrency Level (2-10) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 7.1. Metrics Periodic Reporting - * 8.2.1. Create New Items - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.5.2. Load Job - * 10.1.2. Many Local Separate Storage Driver Services (at different ports) - * 10.2.2. Destination Path Precondition Hook - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - * 10.4.5.4.3. Create Dynamic Large Objects - */ - -public class SwiftCreateDloTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "swift", "create-dlo.json" - ); - private static final int EXPECTED_CONCURRENCY = 10; - private static final long EXPECTED_COUNT = 100; - private static final SizeInBytes EXPECTED_SIZE = new SizeInBytes("1GB"); - private static final SizeInBytes EXPECTED_PART_SIZE = new SizeInBytes("64MB"); - - private static boolean FINISHED_IN_TIME; - private static String STD_OUTPUT; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = SwiftCreateDloTest.class.getSimpleName(); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.timedJoin(runner, 300); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - - public void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.CREATE, EXPECTED_CONCURRENCY, - STORAGE_DRIVERS_COUNT, EXPECTED_SIZE, EXPECTED_COUNT, 0 - ); - } - - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.CREATE, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - assertTrue( - "There should be more than " + EXPECTED_COUNT + - " records in the I/O trace log file, but got: " + ioTraceRecords.size(), - EXPECTED_COUNT < ioTraceRecords.size() - ); - final SizeInBytes ZERO_SIZE = new SizeInBytes(0); - final SizeInBytes TAIL_PART_SIZE = new SizeInBytes( - EXPECTED_SIZE.get() % EXPECTED_PART_SIZE.get() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - try { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), ZERO_SIZE); - } catch(final AssertionError e) { - try { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), EXPECTED_PART_SIZE); - } catch(final AssertionError ee) { - testIoTraceRecord(ioTraceRecord, IoType.CREATE.ordinal(), TAIL_PART_SIZE); - } - } - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftReadContainerListingTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftReadContainerListingTest.java deleted file mode 100644 index a7385756a0..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/SwiftReadContainerListingTest.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.common.env.PathUtil; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.run.scenario.JsonScenario; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.PortListener; -import com.emc.mongoose.ui.cli.CliArgParser; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - Created by andrey on 01.06.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (10KB) - * 2.2.2. Path Listing - * 2.3.3.1. Constant Destination Path - * 4.4. Big Concurrency Level (1K) - * 8.3.2. Read - Enabled Validation - * 9.2. Default Scenario - * 9.5.2. Load Job - * 10.1.4. Two Local Separate Storage Driver Services (at different ports) - * 10.2.2. Destination Path Precondition Hook - * 10.4.4. I/O Buffer Size Adjustment for Optimal Performance - */ - -public class SwiftReadContainerListingTest -extends HttpStorageDistributedScenarioTestBase { - - private static final SizeInBytes ITEM_DATA_SIZE = new SizeInBytes("10KB"); - private static final String ITEM_OUTPUT_PATH = SwiftReadContainerListingTest - .class.getSimpleName(); - private static final int LOAD_CONCURRENCY = 10; - private static final int LOAD_LIMIT_TIME = 50; - - private static String STD_OUTPUT = null; - private static int ACTUAL_CONCURRENCY = 0; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = SwiftReadContainerListingTest.class.getSimpleName(); - CONFIG_ARGS.add("--item-data-size=" + ITEM_DATA_SIZE.toString()); - CONFIG_ARGS.add("--item-output-path=" + ITEM_OUTPUT_PATH); - CONFIG_ARGS.add("--storage-driver-concurrency=100"); - CONFIG_ARGS.add("--storage-driver-type=swift"); - CONFIG_ARGS.add("--storage-net-http-namespace=ns1"); - CONFIG_ARGS.add("--test-step-limit-time=" + LOAD_LIMIT_TIME); - CONFIG_ARGS.add("--test-step-name=" + STEP_NAME); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - HttpStorageDistributedScenarioTestBase.setUpClass(); - SCENARIO.run(); - - // reinit - SCENARIO.close(); - STEP_NAME = SwiftReadContainerListingTest.class.getSimpleName() + "_"; - FileUtils.deleteDirectory(Paths.get(PathUtil.getBaseDir(), "log", STEP_NAME).toFile()); - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - LogUtil.init(); - CONFIG_ARGS.add("--item-data-verify"); - CONFIG_ARGS.add("--item-input-path=" + ITEM_OUTPUT_PATH); - CONFIG_ARGS.add("--load-type=read"); - CONFIG_ARGS.add("--storage-driver-concurrency=" + LOAD_CONCURRENCY); - CONFIG_ARGS.add("--test-step-name=" + STEP_NAME); - CONFIG.apply( - CliArgParser.parseArgs( - CONFIG.getAliasingConfig(), CONFIG_ARGS.toArray(new String[CONFIG_ARGS.size()]) - ) - ); - CONFIG.getItemConfig().getOutputConfig().setPath(null); - CONFIG.getTestConfig().getStepConfig().getLimitConfig().setTime(0); - CONFIG.getTestConfig().getStepConfig().setName(STEP_NAME); - SCENARIO = new JsonScenario(CONFIG, DEFAULT_SCENARIO_PATH.toFile()); - - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.sleep(10); // warmup - final int startPort = CONFIG.getStorageConfig().getNetConfig().getNodeConfig().getPort(); - for(int i = 0; i < STORAGE_NODE_COUNT; i ++) { - ACTUAL_CONCURRENCY += PortListener - .getCountConnectionsOnPort("127.0.0.1:" + (startPort + i)); - } - TimeUnit.MINUTES.timedJoin(runner, 5); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testActiveConnectionsCount() - throws Exception { - assertEquals(STORAGE_DRIVERS_COUNT * LOAD_CONCURRENCY, ACTUAL_CONCURRENCY); - } - - public void testMetricsLogFile() - throws Exception { - testMetricsLogRecords( - getMetricsLogRecords(), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, 0, 0, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - testTotalMetricsLogRecord( - getMetricsTotalLogRecords().get(0), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, 0, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, LOAD_CONCURRENCY, STORAGE_DRIVERS_COUNT, ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - final List ioTraceRecords = getIoTraceLogRecords(); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), ITEM_DATA_SIZE); - } - } - - public void testIoBufferSizeAdjustment() - throws Exception { - String msg = "Adjust input buffer size: " + ITEM_DATA_SIZE.toString(); - int k; - for(int i = 0; i < STORAGE_DRIVERS_COUNT; i ++) { - k = STD_OUTPUT.indexOf(msg); - if(k > -1) { - msg = STD_OUTPUT.substring(k + msg.length()); - } else { - fail("Expected the message to occur " + STORAGE_DRIVERS_COUNT + " times, but got " + i); - } - } - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/TlsReadUpdatedMultipleRandomRangesTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/TlsReadUpdatedMultipleRandomRangesTest.java deleted file mode 100644 index b9cd569d9e..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/TlsReadUpdatedMultipleRandomRangesTest.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.common.api.SizeInBytes; -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.commons.csv.CSVRecord; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 07.02.17. - Covered use cases: - * 2.1.1.1.3. Intermediate Size Data Items (100KB-10MB) - * 2.2.1. Items Input File - * 2.2.3.1. Random Item Ids - * 2.3.2. Items Output File - * 2.3.3.1. Constant Items Destination Path - * 4.1. Default Concurrency Level (1) - * 6.1. Load Jobs Naming - * 6.2.2. Limit Load Job by Processed Item Count - * 8.2.1. Create New Items - * 8.3.2. Read With Enabled Validation - * 8.3.3.2.4. Read Multiple Fixed Ranges - * 9.3. Custom Scenario File - * 9.4.3. Reusing The Items in the Scenario - * 9.5.2. Load Job - * 9.5.5. Sequential Job - * 10.1.2. Two Local Separate Storage Driver Services (at different ports) - */ - -public class TlsReadUpdatedMultipleRandomRangesTest -extends HttpStorageDistributedScenarioTestBase { - - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "partial", "read-multiple-random-ranges-updated.json" - ); - private static final SizeInBytes EXPECTED_ITEM_DATA_SIZE = new SizeInBytes("1-1KB"); - private static final int EXPECTED_CONCURRENCY = 4; - private static final long EXPECTED_COUNT = 1000; - private static final String ITEM_OUTPUT_FILE_0 = "read-multiple-random-ranges-0.csv"; - private static final String ITEM_OUTPUT_FILE_1 = "read-multiple-random-ranges-1.csv"; - - private static String STD_OUTPUT; - private static boolean FINISHED_IN_TIME; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = TlsReadUpdatedMultipleRandomRangesTest.class.getSimpleName(); - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_1)); - } catch(final Exception ignored) { - } - try { - Files.delete(Paths.get(ITEM_OUTPUT_FILE_0)); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--item-data-verify=true"); - CONFIG_ARGS.add("--storage-driver-concurrency=" + EXPECTED_CONCURRENCY); - CONFIG_ARGS.add("--storage-net-ssl=true"); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.MINUTES.timedJoin(runner, 2); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public final void testFinishedInTime() { - assertTrue(FINISHED_IN_TIME); - } - - - public final void testMetricsLogFile() - throws Exception { - final List metricsLogRecords = getMetricsLogRecords(); - assertTrue( - "There should be more than 0 metrics records in the log file", - metricsLogRecords.size() > 0 - ); - testMetricsLogRecords( - metricsLogRecords, IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, - EXPECTED_COUNT, 0, CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - - public void testTotalMetricsLogFile() - throws Exception { - final List totalMetrcisLogRecords = getMetricsTotalLogRecords(); - assertEquals( - "There should be 1 total metrics records in the log file", 1, - totalMetrcisLogRecords.size() - ); - testTotalMetricsLogRecord( - totalMetrcisLogRecords.get(0), IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, - EXPECTED_ITEM_DATA_SIZE, EXPECTED_COUNT, 0 - ); - } - - public void testMetricsStdout() - throws Exception { - testSingleMetricsStdout( - STD_OUTPUT.replaceAll("[\r\n]+", " "), - IoType.READ, EXPECTED_CONCURRENCY, STORAGE_DRIVERS_COUNT, EXPECTED_ITEM_DATA_SIZE, - CONFIG.getTestConfig().getStepConfig().getMetricsConfig().getPeriod() - ); - } - - public void testIoTraceLogFile() - throws Exception { - TimeUnit.SECONDS.sleep(15); - final List ioTraceRecords = getIoTraceLogRecords(); - assertEquals( - "There should be " + EXPECTED_COUNT + " records in the I/O trace log file", - EXPECTED_COUNT, ioTraceRecords.size() - ); - for(final CSVRecord ioTraceRecord : ioTraceRecords) { - testIoTraceRecord(ioTraceRecord, IoType.READ.ordinal(), EXPECTED_ITEM_DATA_SIZE); - } - } - - public void testTlsEnableLogged() - throws Exception { - final List msgLogLines = getMessageLogLines(); - int msgCount = 0; - for(final String msgLogLine : msgLogLines) { - if(msgLogLine.contains(STEP_NAME + ": SSL/TLS is enabled for the channel")) { - msgCount ++; - } - } - // 3 steps + additional bucket checking/creating connections - Assert.assertTrue(3 * STORAGE_DRIVERS_COUNT * EXPECTED_CONCURRENCY <= msgCount); - } -} diff --git a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/WeightedLoadTest.java b/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/WeightedLoadTest.java deleted file mode 100644 index b59e790bf4..0000000000 --- a/tests/system/src/test/java/com/emc/mongoose/tests/system/deprecated/WeightedLoadTest.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.emc.mongoose.tests.system.deprecated; - -import com.emc.mongoose.model.io.IoType; -import com.emc.mongoose.tests.system.base.deprecated.HttpStorageDistributedScenarioTestBase; -import com.emc.mongoose.tests.system.util.PortListener; -import com.emc.mongoose.ui.log.LogUtil; -import com.emc.mongoose.ui.log.appenders.LoadJobLogFileManager; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.ThreadContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import static com.emc.mongoose.common.Constants.KEY_STEP_NAME; -import static com.emc.mongoose.common.env.PathUtil.getBaseDir; -import static com.emc.mongoose.run.scenario.Scenario.DIR_SCENARIO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - Created by andrey on 27.03.17. - Covered use cases: - * 2.1.1.1.2. Small Data Items (1B-100KB) - * 2.2.1. Items Input File - * 2.3.2. Items Output File - * 4.3. Medium Concurrency Level (11-100) - * 5. Circularity - * 6.2.2. Limit Step by Processed Item Count - * 6.2.5. Limit Step by Time - * 7.1. Metrics Periodic Reporting - * 7.2. Metrics Reporting is Suppressed for the Precondition Steps - * 8.2.1. Create New Items - * 8.3.1. Read With Disabled Validation - * 9.1. Scenarios Syntax - * 9.3. Custom Scenario File - * 9.4.1. Override Default Configuration in the Scenario - * 9.4.2. Step Configuration Inheritance - * 9.4.3. Reusing The Items in the Scenario - * 9.5.7.2. Weighted Load Step - * 10.1.2. Many Local Separate Storage Driver Services (at different ports) - */ - -public class WeightedLoadTest -extends HttpStorageDistributedScenarioTestBase { - private static final Path SCENARIO_PATH = Paths.get( - getBaseDir(), DIR_SCENARIO, "mixed", "weighted.json" - ); - private static final int EXPECTED_CONCURRENCY = 100 + 100; - - private static boolean FINISHED_IN_TIME; - private static String STD_OUTPUT; - private static int ACTUAL_CONCURRENCY; - - @BeforeClass - public static void setUpClass() - throws Exception { - STEP_NAME = WeightedLoadTest.class.getSimpleName(); - try { - Files.delete(Paths.get("weighted-load.csv")); - } catch(final Exception ignored) { - } - ThreadContext.put(KEY_STEP_NAME, STEP_NAME); - CONFIG_ARGS.add("--test-scenario-file=" + SCENARIO_PATH.toString()); - HttpStorageDistributedScenarioTestBase.setUpClass(); - final Thread runner = new Thread( - () -> { - try { - STD_OUT_STREAM.startRecording(); - SCENARIO.run(); - STD_OUTPUT = STD_OUT_STREAM.stopRecordingAndGet(); - } catch(final Throwable t) { - LogUtil.exception(Level.ERROR, t, "Failed to run the scenario"); - } - } - ); - runner.start(); - TimeUnit.SECONDS.sleep(30); // warmup - final int startPort = CONFIG.getStorageConfig().getNetConfig().getNodeConfig().getPort(); - for(int i = 0; i < STORAGE_NODE_COUNT; i ++) { - ACTUAL_CONCURRENCY += PortListener - .getCountConnectionsOnPort("127.0.0.1:" + (startPort + i)); - } - TimeUnit.SECONDS.timedJoin(runner, 100); - FINISHED_IN_TIME = !runner.isAlive(); - runner.interrupt(); - LoadJobLogFileManager.flush(STEP_NAME); - TimeUnit.SECONDS.sleep(10); - } - - @AfterClass - public static void tearDownClass() - throws Exception { - HttpStorageDistributedScenarioTestBase.tearDownClass(); - } - - - public void testFinishedInTime() { - assertTrue("Scenario didn't finished in time", FINISHED_IN_TIME); - } - - - public void testActualConcurrency() { - assertEquals(STORAGE_DRIVERS_COUNT * EXPECTED_CONCURRENCY, ACTUAL_CONCURRENCY, 5); - } - - - public void testMetricsStdout() - throws Exception { - final Map concurrencyMap = new HashMap<>(); - concurrencyMap.put(IoType.CREATE, 100); - concurrencyMap.put(IoType.READ, 100); - final Map weightsMap = new HashMap<>(); - testMetricsTableStdout(STD_OUTPUT, STEP_NAME, STORAGE_DRIVERS_COUNT, 0, concurrencyMap); - } - -}